Skip to content

Repository of data structures and algorithms from GeeksForGeeks, Leetcode, Aditya Verma, HackerRank etc

Notifications You must be signed in to change notification settings

kd-labs/dsa-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Solutions

Recurions + BackTracking

# Title Difficulty Complexity Solution
131 Palindrome Partitioning Time - O(n)
Space - O(1)
Medium Java
17 Letter Combinations of a Phone Number Time - O(n)
Space - O(1)
Medium Java
55 Jump Game - Without DP Time - O(n)
Space - O(1)
Medium Java
51 N-Queens Time - O(n)
Space - O(1)
Hard Java
52 N-QueensII Time - O(n)
Space - O(1)
Hard Java
37 Sudoku Solver Time - O(n)
Space - O(1)
Hard Java
46 Permutations Time - O(n)
Space - O(1)
Medium Java
47 Permutations II Time - O(n)
Space - O(1)
Medium Java
77 Combinations Time - O(n)
Space - O(1)
Medium Java
39 CombinationSum Time - O(n)
Space - O(1)
Medium Java
40 Combination Sum II Time - O(n)
Space - O(1)
Medium Java
216 Combination Sum III Time - O(n)
Space - O(1)
Medium Java
139 Word Break Without DP Time - O(n)
Space - O(1)
Medium Java
79 Word Search Time - O(n)
Space - O(1)
Medium Java
78 Subsets Time - O(n)
Space - O(1)
Medium Java
90 Subsets II Time - O(n)
Space - O(1)
Medium Java

Dynamic Programming

# Title Difficulty Complexity Solution
198 House Robber Time - O(n)
Space - O(1)
Medium Java
518 Coin Change II Time - O(n)
Space - O(1)
Medium Java
115 Distinct Subsequences Time - O(n)
Space - O(1)
Hard Java
1143 Longest Common Subsequence Time - O(n)
Space - O(1)
Medium Java
1035 Uncrossed Lines Time - O(n)
Space - O(1)
Medium Java
72 Edit Distance Time - O(n)
Space - O(1)
Hard Java
300 Longest Increasing Subsequence Time - O(n)
Space - O(1)
Medium Java

Map

# Title Difficulty Complexity Solution
350 Intersection of Two Arrays II Time - O(n)
Space - O(1)
Easy Java
49 Group Anagrams Time - O(n)
Space - O(1)
Medium Java
128 Longest Consecutive Sequence Time - O(n)
Space - O(1)
Medium Java

Strings

# Title Difficulty Complexity Solution
647 Palindromic Substrings Medium Java

Heap

# Title Difficulty Complexity Solution
215 Kth Largest Element in an Array Time - O(n)
Space - O(1)
Medium Java

Tree/BST

# Title Difficulty Complexity Solution
101 Symmetric Tree Time - O(n)
Space - O(1)
Easy Java
951 Flip Equivalent Binary Trees Time - O(n)
Space - O(1)
Medium Java
112 Path Sum Time - O(n)
Space - O(1)
Easy Java
543 Diameter of Binary Tree Time - O(n)
Space - O(1)
Easy Java
701 Insert into a Binary Search Tree Time - O(n)
Space - O(1)
Medium Java
110 Balanced Binary Tree Time - O(n)
Space - O(1)
Easy Java
98 Validate Binary Search Tree Time - O(n)
Space - O(1)
Medium Java
450 Delete Node in a BST Time - O(n)
Space - O(1)
Medium Java
236 Lowest Common Ancestor of a Binary Tree Time - O(n)
Space - O(1)
Medium Java
105 Construct Binary Tree from Preorder and Inorder Traversal Time - O(n)
Space - O(1)
Medium Java

Sliding Window

# Title Difficulty Complexity Solution
239 Sliding Window Maximum Time - O(n)
Space - O(1)
Hard Java
209 Minimum Size Subarray Sum Time - O(n)
Space - O(1)
Medium Java
904 Fruits Into Basket Time - O(n)
Space - O(1)
Medium Java
1358 Number of Substrings Containing All Three Characters Time - O(n)
Space - O(1)
Medium Java
424 Longest Repeating Character Replacement Time - O(n)
Space - O(1)
Medium Java
930 Binary Subarrays With Sum Time - O(n)
Space - O(1)
Medium Java
1248 Count Number of Nice Subarrays Time - O(n)
Space - O(1)
Medium Java
1234 Replace the Substring for Balanced String Time - O(n)
Space - O(1)
Medium Java
1004 Max Consecutive Ones III Time - O(n)
Space - O(1)
Medium Java
1208 Get Equal Substrings Within Budget Time - O(n)
Space - O(1)
Medium Java
30 Substring with Concatenation of All Words Time - O(n)
Space - O(1)
Hard Java

Arrays

# Title Difficulty Complexity Solution
1 Two Sum Time - O(n)
Space - O(1)
Easy Java
23 Remove Duplicates from Sorted Array Time - O(n)
Space - O(1)
Easy Java
1769 Minimum Number of Operations to Move All Balls to Each Box Time - O(n)
Space - O(1)
Medium Java
189 Rotate Array Time - O(n)
Space - O(1)
Medium Java
238 Product of Array Except Self Time - O(n)
Space - O(1)
Medium Java
42 Trapping Rain Water Time - O(n)
Space - O(n)
Hard Java
53 Maximum Subarray Time - O(n)
Space - O(1)
Easy Java
134 Gas Station Time - O(n)
Space - O(1)
Medium Java
349 Intersection of Two Arrays Time - O(n)
Space - O(1)
Easy Java
88 Merge Sorted Array Time - O(n)
Space - O(1)
Easy Java
26 Remove Duplicates from Sorted Array Time - O(n)
Space - O(1)
Easy Java
169 Majority Element Time - O(n)
Space - O(1)
Easy Java
268 Missing Number Time - O(n)
Space - O(1)
Easy Java
217 Contains Duplicate Time - O(n)
Space - O(1)
Easy Java
283 Move Zeroes Time - O(n)
Space - O(1)
Easy Java
287 Find the Duplicate Number Time - O(n)
Space - O(1)
Medium Java

2 Pointers

# Title Difficulty Complexity Solution
167 Two Sum II - Input Array Is Sorted Time - O(n)
Space - O(1)
Medium Java
15 3Sum Time - O(n2)
Space - O(1)
Medium Java
844 Backspace String Compare Time - O(n)
Space - O(n)
Easy Java

Binary Search

# Title Difficulty Complexity Solution
278 First Bad Version Time - O(log(n))
Space - O(1)
Easy Java
240 Search a 2D Matrix II Time - O(log(n))
Space - O(1)
Medium Java
35 Search Insert Position Time - O(log(n))
Space - O(1)
Easy Java
69 Sqrt(x) Time - O(log(n))
Space - O(1)
Easy Java

Grokking Interview Pattern Solutions

Sliding Window

# Title Difficulty Complexity Solution
239 Longest Substring with maximum K Distinct Characters Time - O(n)
Space - O(1)
Medium Java

About

Repository of data structures and algorithms from GeeksForGeeks, Leetcode, Aditya Verma, HackerRank etc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages