Code Monkey home page Code Monkey logo

javascriptalgorithms's Introduction

Hi, I'm Viktoria πŸ‘‹ πŸ‘©πŸ»β€πŸ’»

About me

After finishing the IT-HTL in Ybbs with my Major Internet- and Media I workes as C# Developer and Software-Tester in Vienna. In October 2012 I started studying Business Informatics at the Johannes Kepler University Linz. Additional to the Study I started working as IT-Allrounder and Driving Teacher at Easy Drivers. A year before I finished my Business Informatics Study I was recruited by epunkt to work as Active Sourcer with Focus on IT-Jobs and Softwaredeveloper. In April 2019 I changed the department at epunkt and I'm now working as ❀️Software Developer, IT-Application and Projectmanager, with small steps I started in Datawarehousing and Data Analytics, did my first PowerBI Reports πŸ“Š and I love it ❀️. Thank you epunkt ❀️ Best Place to work! ❀️ #epunktliebtdich Since May 2021 I am proud Mum of a beautiful little Girl and started my Master Studies at JKU during my maternity leave in October 2021, currently ongoing.

Things I am passionate about

  • πŸ‘©πŸ»β€πŸ’» Coding
  • πŸ“Έ Make Photos with my Nikon ❀️
  • 🐢 Dogs
  • πŸ€“ Learn new Stuff

I'm currently learning

🌱 TypeScript & Angular | 🌱 Driving Deeper into HTML & CSS | 🌱 3 new languages: dutch, turkish, italian | 🌱 Network & Security | 🌱 Plant Based Diet

Get in touch β˜•

dev dev instagram twitter stackoverflow facebook

Some Github Stats

Viki's github stats

javascriptalgorithms's People

Contributors

aayushtiw avatar aprilxyc avatar ccjmne avatar cheec avatar danielcaldas avatar dependabot[bot] avatar dhkamp avatar iron-bergh avatar j-purview avatar josehkburger avatar jrga03 avatar lanhbao avatar lashuk1729 avatar marialuize avatar nathanpickard avatar osusara avatar paulooosrj avatar pawankolhe avatar priyanshu2510 avatar prof-lupin avatar psalmfill avatar qdtroemner avatar quadriphobs1 avatar raffleberry avatar rajneeshkumar146 avatar rubiin avatar sarahsakhri avatar theleek avatar uddeshjain avatar vjechsmayr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

javascriptalgorithms's Issues

Combination Sum

Create File combinationSum.js into directory Backtracking

See LeetCodeProblem here

Create your file in the folder Backtracking - don't forget to delete Combination Sum from the AlgorithmsToDo`-file

Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.

The same repeated number may be chosen from candidates unlimited number of times.

Note:

  • All numbers (including target) will be positive integers.
  • The solution set must not contain duplicate combinations.

Example 1:

Input: candidates = [2,3,6,7], target = 7,
A solution set is:
[
  [7],
  [2,2,3]
]

Palindrome Number Algorithm

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.

Input: 121
Output: true

See Problem here

Bubble Sort

looking for the "Bubble Sort"-Algorithm in JavaScript

Fibonacci Search Algorithm

Given a sorted array arr[] of size n and an element x to be searched in it. Return index of x if it is present in array else return -1.
Examples:

Input:  arr[] = {2, 3, 4, 10, 40}, x = 10
Output:  3
Element x is present at index 3.

Input:  arr[] = {2, 3, 4, 10, 40}, x = 11
Output:  -1
Element x is not present.

Fibonacci Search is a comparison-based technique that uses Fibonacci numbers to search an element in a sorted array.

Permutations Algorithm

See LeetCode Problem here

Given a collection of distinct integers, return all possible permutations.

Example:

Input: [1,2,3]
Output:
[
  [1,2,3],
  [1,3,2],
  [2,1,3],
  [2,3,1],
  [3,1,2],
  [3,2,1]
]

Code:

/**
 * @param {number[]} nums
 * @return {number[][]}
 */
var permute = function(nums) {
    
};

Sudoku Solver

Write an Algorithm to Solve a Sudoku puzzle by filling the empty cells.

Empty cells are indicated by the character '.'.

Input:
[
  ["5","3",".",".","7",".",".",".","."],
  ["6",".",".","1","9","5",".",".","."],
  [".","9","8",".",".",".",".","6","."],
  ["8",".",".",".","6",".",".",".","3"],
  ["4",".",".","8",".","3",".",".","1"],
  ["7",".",".",".","2",".",".",".","6"],
  [".","6",".",".",".",".","2","8","."],
  [".",".",".","4","1","9",".",".","5"],
  [".",".",".",".","8",".",".","7","9"]
]

See Problem here

Binary Addition

Given two binary strings, return their sum (also a binary string).

The input strings are both non-empty and contains only characters 1 or 0.

Input: a = "11", b = "1"
Output: "100"

Code:

/**
 * @param {string} a
 * @param {string} b
 * @return {string}
 */
var addBinary = function(a, b) {
    
};

See Problem here

Permutation Algorithm

Given a collection of distinct integers, return all possible permutations.

Input: [1,2,3]
Output:
[
  [1,2,3],
  [1,3,2],
  [2,1,3],
  [2,3,1],
  [3,1,2],
  [3,2,1]
]

See Problem here

Valid Sudoku Algorithm

Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:

  1. Each row must contain the digits 1-9 without repetition.
  2. Each column must contain the digits 1-9 without repetition.
  3. Each of the 9 3x3 sub-boxes of the grid must contain the digits 1-9 without repetition.

The Sudoku board could be partially filled, where empty cells are filled with the character '.'.

Input:
[
  ["5","3",".",".","7",".",".",".","."],
  ["6",".",".","1","9","5",".",".","."],
  [".","9","8",".",".",".",".","6","."],
  ["8",".",".",".","6",".",".",".","3"],
  ["4",".",".","8",".","3",".",".","1"],
  ["7",".",".",".","2",".",".",".","6"],
  [".","6",".",".",".",".","2","8","."],
  [".",".",".","4","1","9",".",".","5"],
  [".",".",".",".","8",".",".","7","9"]
]
Output: true

Note:

  • A Sudoku board (partially filled) could be valid but is not necessarily solvable.
  • Only the filled cells need to be validated according to the mentioned rules.
  • The given board contain only digits 1-9 and the character '.'.
  • The given board size is always 9x9.

See LeetCode Problem here: Valid Sudoku

Merge Sort

looking for the "Merge Sort"-Algorithm in JavaScript

Letter Combinations of a Phone Number

See LeetCode Problem here: Letter Combinations

Create your file in the folder Backtracking - don't forget to delete Letter Combinations of a Phone Number from the AlgorithmsToDo`-file

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.

A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.

Example:

Input: "23"
Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].

Note:
Although the above answer is in lexicographical order, your answer could be in any order you want.

Code:

/**
 * @param {string} digits
 * @return {string[]}
 */
var letterCombinations = function(digits) {
    
};

Permission to add WeightedMean Algorithm

Hello, I was wondering if I could add an algorithm to find the weighted mean of a list of numbers and their weights?

I've already completed the algorithm, I just wanted to get permission to add it before I opened a pull request.

Roman to (decimal) Number

Algorithm to Convert a Roman Number to a decimal Number

Symbol       Value
I             1
V             5
X             10
L             50
C             100
D             500
M             1000

Example:

Input: "IV"
Output: 4

See Problem here

Setup/Organisation Structure

It would be a good idea to have few things in place for a good organisation and to support for a contribution

  1. Contribution guide
  2. License
  3. Use of JavaScript/Node package.json to manage commands
  4. Writing extensive for each algorithm to verify its validity
  5. Folder organisation for each algorithm in its own scope

Suggetion for folder

package.json
insertionsort/
insertionsort/insertionsort.js
insertionsort/insertionsort.test.js

I can create a quick PR for the folder organisation if that will be welcomed

Day of the Week

See LeetCode Problem here

Insert file 1185_DayOfTheWeek.js into folder LeetCode Solutions

Given a date, return the corresponding day of the week for that date.

The input is given as three integers representing the day, month and year respectively.

Return the answer as one of the following values {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}.

Example 1:

Input: day = 31, month = 8, year = 2019
Output: "Saturday"

Example 2:

Input: day = 18, month = 7, year = 1999
Output: "Sunday"

Example 3:

Input: day = 15, month = 8, year = 1993
Output: "Sunday"

Constraints:

  • The given dates are valid dates between the years 1971 and 2100.

Converted Sorted List to Binary Search Tree

Algorithm for Problem 109 at LeetCode.com

Example:

Given the sorted linked list: [-10,-3,0,5,9],

One possible answer is: [0,-3,9,-10,null,5], which represents the following height balanced BST:

      0
     / \
   -3   9
   /   /
 -10  5

Code:

/**
 * Definition for singly-linked list.
 * function ListNode(val) {
 *     this.val = val;
 *     this.next = null;
 * }
 */
/**
 * Definition for a binary tree node.
 * function TreeNode(val) {
 *     this.val = val;
 *     this.left = this.right = null;
 * }
 */
/**
 * @param {ListNode} head
 * @return {TreeNode}
 */
var sortedListToBST = function(head) {
    
};

See Problem here

Reshape the Matrix

See LeetCode Problem here

Insert file 566_ReshapeTheMatrix.js into folder LeetCode Solutions

In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.

You're given a matrix represented by a two-dimensional array, and two positive integers r and c representing the row number and column number of the wanted reshaped matrix, respectively.

The reshaped matrix need to be filled with all the elements of the original matrix in the same row-traversing order as they were.

If the 'reshape' operation with given parameters is possible and legal, output the new reshaped matrix; Otherwise, output the original matrix.

Example 1:

Input: 
nums = 
[[1,2],
 [3,4]]
r = 1, c = 4
Output: 
[[1,2,3,4]]
Explanation:
The row-traversing of nums is [1,2,3,4]. The new reshaped matrix is a 1 * 4 matrix, fill it row by row by using the previous list.

Note:

  • The height and width of the given matrix is in range [1, 100].
  • The given r and c are all positive.

Code

/**
 * @param {number[][]} nums
 * @param {number} r
 * @param {number} c
 * @return {number[][]}
 */
var matrixReshape = function(nums, r, c) {
    
};

Regular Expression Matching

See LeetCode Problem here: Regular Expression Matching

Create your file in the folder Backtracking - don't forget to delete Regular Expression Matching from the AlgorithmsToDo-file

Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.

'.' Matches any single character.
'*' Matches zero or more of the preceding element.

The matching should cover the entire input string (not partial).

Note:

  • s could be empty and contains only lowercase letters a-z.
  • p could be empty and contains only lowercase letters a-z, and characters like . or *.

Code:

/**
 * @param {string} s
 * @param {string} p
 * @return {boolean}
 */
var isMatch = function(s, p) {
    
};

Insertion Sort

looking for the "Insertion Sort"-Algorithm in JavaScript

Selection Sort

looking for the "Selection Sort"-Algorithm in JavaScript

Combinations

See LeetCode Problem here

Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.

Example:

Input: n = 4, k = 2
Output:
[
  [2,4],
  [3,4],
  [2,3],
  [1,2],
  [1,3],
  [1,4],
]

Restore IP-Addresses

Create file restore_ipAddresses.js it folder Backtracking - don't forget to delete Combination Sum from the AlgorithmsToDo`-file

See LeetCode Problem here

Given a string containing only digits, restore it by returning all possible valid IP address combinations.

Example:

Input: "25525511135"
Output: ["255.255.11.135", "255.255.111.35"]

Tree Sort

looking for the "Tree Sort"-Algorithm in JavaScript

Wildcard Matching Algorithm

See Problem here

Create your file in the folder Backtracking - don't forget to delete Wildcard Matching from the AlgorithmsToDo`-file

Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*'.

'?' Matches any single character.
'*' Matches any sequence of characters (including the empty sequence).

The matching should cover the entire input string (not partial).

Note:

s could be empty and contains only lowercase letters a-z.
p could be empty and contains only lowercase letters a-z, and characters like ? or *.

Example:

Input:
s = "aa"
p = "*"
Output: true
Explanation: '*' matches any sequence.

Subsets

See LeetCode Problem here

Given a set of distinct integers, nums, return all possible subsets (the power set).

Note: The solution set must not contain duplicate subsets.

Example:

Input: nums = [1,2,3]
Output:
[
  [3],
  [1],
  [2],
  [1,2,3],
  [1,3],
  [2,3],
  [1,2],
  []
]

Code

/**
 * @param {number[]} nums
 * @return {number[][]}
 */
var subsets = function(nums) {
    
};

Solutions for LeetCode in JavaScript

You can contribute solutions for LeetCode algorithm with the programming language JavaScript

Look in the folders for the Algorithms_ToDo-file to see which Problems are open to contribute.

Good practice coding :)

N-Queens

Create file nqueens.js at folder Backtracking - don't forget to delete Combination Sum from the AlgorithmsToDo`-file

See LeetCode Problem here

The n-queens puzzle is the problem of placing n queens on an nΓ—n chessboard such that no two queens attack each other.

Given an integer n, return all distinct solutions to the n-queens puzzle.

Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' both indicate a queen and an empty space respectively.

Example:

Input: 4
Output: [
 [".Q..",  // Solution 1
  "...Q",
  "Q...",
  "..Q."],

 ["..Q.",  // Solution 2
  "Q...",
  "...Q",
  ".Q.."]
]

Fibonacci Algorithm

Algorithm to calculate the Fibonacci Series.

Input: 10
Output: 1 1 2 3 5 8 13 21 34 55

Sort an Array

Given an array of integers nums, sort the array in ascending order.

Input: [5,2,3,1]
Output: [1,2,3,5]

Note:

1 <= A.length <= 10000
-50000 <= A[i] <= 50000

Code:

/**
 * @param {number[]} nums
 * @return {number[]}
 */
var sortArray = function(nums) {
    
};

See Problem here

Permutations 2 Algorithm

See LeetCode Problem here

Given a collection of numbers that might contain duplicates, return all possible unique permutations.

Example:

Input: [1,1,2]
Output:
[
  [1,1,2],
  [1,2,1],
  [2,1,1]
]

Code

/**
 * @param {number[]} nums
 * @return {number[][]}
 */
var permuteUnique = function(nums) {
    
};

Two Sum

See Problem here: Two Sum

Add your Solution to the Other Algorithm Directory

Generate Parentheses

See LeetCode Problem here

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

For example, given n = 3, a solution set is:

[
  "((()))",
  "(()())",
  "(())()",
  "()(())",
  "()()()"
]

Code
/**
@param {number} n
@return {string[]}
*/
var generateParenthesis = function(n) {

};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.