Skip to content

A curated list of solved DSA problems and implementations in JavaScript

Notifications You must be signed in to change notification settings

kartikth40/DSA-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSA-javascript-Interviews

  • This repo contains important solved leetCode problems for Interviews in JavaScript with some basic Data Structures and Algorithms Implementations.

  • I will keep updating it with every problem statement that I will solve.

  • If you find any error in my codes then feel free to open up a new issue or even making a pull request.

LeetCode Problems

Title Solution Difficulty Category
1. Two Sum Solution Easy Array, Hash Table
242. Valid Anagram Solution Easy Hash Table, String, Sorting
217. Contains Duplicate Solution Easy Array, Hash Table, Sorting
14. Longest Common Prefix Solution Easy String, Trie
20. Valid Parentheses Solution Easy String, Stack
121. Best Time to Buy and Sell Stock Solution Easy Array, DP
234. Palindrome Linked List Solution Easy Linked List, Two Pointers, Stack, Recursion
141. Linked List Cycle Solution Easy Hash Table, Linked List, Two Pointers
110. Balanced Binary Tree Solution Easy Tree, DFS
100. Same Tree Solution Easy Tree, DFS, BFS
572. Subtree of Another Tree Solution Easy Tree, DFS, BFS
543. Diameter of Binary Tree Solution Easy Tree, DFS
1046. Last Stone Weight Solution Easy Array, Heap
160. Intersection of Two Linked Lists Solution Medium Hash Table, Linked List, Two Pointers
567. Permutation in String Solution Medium Hash Table, Two Pointers, String, Sliding Window
5. Longest Palindromic Substring Solution Medium String, DP
739. Daily Temperatures Solution Medium Array, Stack, Monotonic Stack
11. Container With Most Water Solution Medium Array, Two Pointers, Greedy
3. Longest Substring Without Repeating Characters Solution Medium Hash Table, String, Sliding Window
19. Remove Nth Node From End of List Solution Medium Linked List, Two Pointers
2. Add Two Numbers Solution Medium Linked List, Math, Recursion
146. LRU Cache Solution Medium Hash Table, Linked List, Design
22. Generate Parentheses Solution Medium String, DP, Backtracking
122. Best Time to Buy and Sell Stock II Solution Medium Array, DP, Greedy
204. Count Primes Solution Medium Array, Math, Enumeration, Number Theory
128. Longest Consecutive Sequence Solution Medium Array, Hash Table, Union Find
424. Longest Repeating Character Replacement Solution Medium Hash Table, String, Sliding Window
300. Longest Increasing Subsequence Solution Medium Array, Binary Search, DP
347. Top K Frequent Elements Solution Medium Array, Hash Table, Sorting, Bucket Sort, Counting, Quickselect
150. Evaluate Reverse Polish Notation Solution Medium Array, Math, Stack
15. 3Sum Solution Medium Array, Two Pointers, Sorting
287. Find the Duplicate Number Solution Medium Array, Two Pointers, Binary Search, Bit Manipulation
162. Find Peak Element Solution Medium Array, Binary Search
33. Search in Rotated Sorted Array Solution Medium Array, Binary Search
34. Find First and Last Position of Element in Sorted Array Solution Medium Array, Binary Search
875. Koko Eating Bananas Solution Medium Array, Binary Search
105. Construct Binary Tree from Preorder and Inorder Traversal Solution Medium Array, Divide and Conquer, Tree
102. Binary Tree Level Order Traversal Solution Medium Tree, BST
1448. Count Good Nodes in Binary Tree Solution Medium Tree, DFS, BFS
98. Validate Binary Search Tree Solution Medium Tree, DFS, BFS
378. Kth Smallest Element in a Sorted Matrix Solution Medium Array, Binary Search, Sorting, Heap, Matrix
235. Lowest Common Ancestor of a Binary Search Tree Solution Medium Tree, DFS, BST
236. Lowest Common Ancestor of a Binary Tree Solution Medium Tree, DFS, BST
17. Letter Combinations of a Phone Number Solution Medium Hash Table, String, Backtracking
116. Populating Next Right Pointers in Each Node Solution Medium Linked List, Tree, DFS, BFS
78. Subsets Solution Medium Array, Backtracking
39. Combination Sum Solution Medium Array, Backtracking
46. Permutations Solution Medium Array, Backtracking
79. Word Search Solution Medium Array, Backtracking, Matrix
90. Subsets II Solution Medium Array, Backtracking
40. Combination Sum II Solution Medium Arrya, Backtracking
131. Palindrome Partitioning Solution Medium String, DP, Backtracking
42. Trapping Rain Water Solution Hard Array, Two Pointers, DP, Stack, Monotonic Stack
84. Largest Rectangle in Histogram Solution Hard Array, Stack, Monotonic Stack
4. Median of Two Sorted Arrays Solution Hard
25. Reverse Nodes in k-Group Solution Hard Linked List, Recursion
76. Minimum Window Substring Solution Hard Hash Table, String, Sliding Window
Sliding Window Maximum Solution Hard Array, Queue, Sliging Window, Heap
297. Serialize and Deserialize Binary Tree Solution Hard String, Tree, DFS, BFS
124. Binary Tree Maximum Path Sum Solution Hard DP, Tree, DFS

Algorithms

Sorting
  • Bubble Sort
  • Counting Sort
  • Heap Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
  • Radix Sort
  • Selection Sort
  • Searching
  • Binary Search
  • Graph Algos
  • BFS
  • DFS
  • Dijkstra Shortest Path
  • Tree Algos
  • BFS
  • DFS
  • Data Structures