Skip to content

This repository is a collection of various algorithms implemented in Node.js using TypeScript.

License

Notifications You must be signed in to change notification settings

shkvik/nodejs-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nodejs-algorithms

This repository is a collection of various algorithms implemented in Node.js using TypeScript.

LeetCode Problems

â„– Problem Title LeetCode Solution Ideal O(Time) Ideal O(Space)
1 Two Sum Link Link $O(n)$ $O(n)$
2 Longest Substring Without Repeating Characters Link Link $O(n)$ $O(min(m,n))$
3 Longest Palindromic Substring Link Link $O(n^2)$ $O(n)$
4 Palindrome Number Link Link $O(log_{10}(n))$ $O(1)$
5 Valid Parentheses Link Link $O(n)$ $O(n)$
6 Generate Parentheses Link Link $O(4^n / \sqrt{n})$ $O(4^n / \sqrt{n})$
7 Merge k Sorted Lists Link Link $O(n \log k)$ $O(k)$
8 Remove Element Link Link $O(n)$ $O(1)$
9 Find the Index of the First Occurrence in a String Link Link $O(n \cdot m)$ $O(1)$
10 Search in Rotated Sorted Array Link Link $O(\log n)$ $O(1)$
11 Trapping Rain Water Link Link $O(n)$ $O(1)$
12 Group Anagrams Link Link $O(n \cdot k \log k)$ $O(nk)$
13 Merge Intervals Link Link $O(n \log n)$ $O(n)$
14 Simplify Path Link Link $O(n)$ $O(n)$
15 Minimum Window Substring Link Link $O(n)$ $O(
16 Merge Sorted Array Link Link $O(n+m)$ $O(1)$
17 Validate Binary Search Tree Link Link $O(n)$ $O(n)$
18 Symmetric Tree Link Link $O(n)$ $O(n)$
19 Maximum Depth of Binary Tree Link Link $O(n)$ $O(h)$
20 Best Time to Buy and Sell Stock Link Link $O(n)$ $O(1)$
21 Binary Tree Maximum Path Sum Link Link $O(n)$ $O(h)$
22 Valid Palindrome Link Link $O(n)$ $O(1)$
23 Single Number Link Link $O(n)$ $O(1)$
24 LRU Cache Link Link $O(1)$ $O(n)$
25 Evaluate Reverse Polish Notation Link Link $O(n)$ $O(n)$
26 Min Stack Link Link $O(1)$ $O(n)$
27 One Edit Distance Link Link $O(n)$ $O(1)$
28 Majority Element Link Link $O(n)$ $O(1)$
29 Binary Tree Right Side View Link Link $O(n)$ $O(h)$
30 Number of Islands Link Link $O(n \cdot m)$ $O(n \cdot m)$
31 Isomorphic Strings Link Link $O(n)$ $O(n)$
32 Reverse Linked List Link Link $O(n)$ $O(1)$
33 Summary Ranges Link Link $O(n)$ $O(1)$
34 Lowest Common Ancestor of a Binary Tree Link Link $O(n)$ $O(h)$
35 Product of Array Except Self Link Link $O(n)$ $O(1)$
36 Meeting Rooms II Link Link $O(n \log n)$ $O(n)$
37 Move Zeroes Link Link $O(n)$ $O(1)$
38 Longest Increasing Subsequence Link Link $O(n \log n)$ $O(n)$
39 Remove Invalid Parentheses Link Link $O(2^n)$ $O(n)$
40 Reconstruct Itinerary Link Link $O(E \log E)$ $O(V + E)$
41 Longest Substring with At Most K Distinct Characters Link Link $O(n)$ $O(k)$
42 Flatten Nested List Iterator Link Link $O(n)$ $O(n)$
43 Intersection of Two Arrays Link Link $O(n \log n)$ $O(n)$
44 Intersection of Two Arrays II Link Link $O(n \log n)$ $O(n)$
45 Line Reflection Link Link $O(n)$ $O(n)$
46 Design Hit Counter Link Link $O(1)$ $O(w)$
47 Insert Delete GetRandom O(1) Link Link $O(1)$ $O(n)$
48 Is Subsequence Link Link $O(n)$ $O(1)$
49 Find All Anagrams in a String Link Link $O(n)$ $O(k)$
50 String Compression Link Link $O(n)$ $O(1)$
51 Max Consecutive Ones Link Link $O(n)$ $O(1)$
52 Max Consecutive Ones II Link Link $O(n)$ $O(1)$
53 Subarray Sum Equals K Link Link $O(n)$ $O(n)$
54 Permutation in String Link Link $O(n)$ $O(1)$
55 Find Duplicate Subtrees Link Link $O(n)$ $O(n)$
56 Robot Return to Origin Link Link $O(n)$ $O(1)$
57 Find K Closest Elements Link Link $O(\log n + k)$ $O(1)$
58 Valid Palindrome II Link Link $O(n)$ $O(1)$
59 Maximize Distance to Closest Person Link Link $O(n)$ $O(1)$
60 Number of Recent Calls Link Link $O(1)$ $O(w)$
61 Squares of a Sorted Array Link Link $O(n)$ $O(n)$
62 Interval List Intersections Link Link $O(n)$ $O(1)$
63 Max Consecutive Ones III Link Link $O(n)$ $O(1)$
64 Sort the Matrix Diagonally Link Link $O(n \cdot m)$ $O(n \cdot m)$
65 Destination City Link Link $O(n)$ $O(n)$
66 Longest Subarray of 1's After Deleting One Element Link Link $O(n)$ $O(1)$
67 Design an ATM Machine Link Link $O(1)$ $O(n)$
68 Promise Pool Link Link $O(n)$ $O(k)$
69 Flatten Deeply Nested Array Link Link $O(n)$ $O(n)$
70 Find the Prefix Common Array of Two Arrays Link Link $O(n)$ $O(1)$
71 Event Emitter Link Link $O(n)$ $O(1)$

About

This repository is a collection of various algorithms implemented in Node.js using TypeScript.

Topics

Resources

License

Stars

Watchers

Forks