X Tutup
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Leet Code Solutions

# Title Solution My Approach Time Complexity My Ratings
1 Spiral Matrix 1. Take Index for start and end of row and column
2. On Traversing a row/Col remove it and decrease or Increase start and End of Corresponding row/Column
2 Spiral Matrix II 1. Take Index for start and end of row and column
2. On Traversing a row/Col remove it and decrease or Increase start and End of Corresponding row/Column
3 Shuffle The Array 1. Take Array 2x size
2. According increase index and place elements from two ends
4 Maximum of Absolute Value Expression 1. Remove Mod and check Possible equations
2.Eliminate certain cases if possible
5 Trapping Rain Water 1. Create Prefix and Postfix Arrays for Man on either side
2.Check Also two pointer approach
6 Greatest Common Divisor of Strings 1. Take help of length of two strings
2.Largest size multiple s=kpt t=pt gcd =tx divides both means it is largest factor of both str1 and str2
7 Subtract the Product and Sum of Digits of an Integer 1. Remove mod and mathematically form and solve for all possible cases.
9 Min Cost Climbing Stairs 1.Solve the Problem using the recursive DP solution approach
10 Intersection of Two Arrays II
11 Number of 1 Bits
12 Remove Duplicates from Sorted Array
13 Rectangle Overlap
14 Greatest Common Divisor of Strings
15 Plus One
16 Subtract the Product and Sum of Digits of an Integer
17 Rectangle Overlap
18 Excel Sheet Column Number
19 Excel Sheet Column Title
20 Unique Paths
21 Remove Element
20 Reverse Integer
21 Factorial Trailing Zeroes
22 Largest Number
23 Reverse Bits
24 Single Number II
25 Divide Two Integers
26 Max Chunks To Make Sorted
27 Single Element in a Sorted Array
28 Minimum Moves to Equal Array Elements
29 Maximize Distance to Closest Person
30 Max Chunks To Make Sorted II
31 Find Peak Element
32 Search in Rotated Sorted Array
33 Minimum Absolute Difference
34 Island Perimeter
35 Search a 2D Matrix II
36 Intersection of Two Linked Lists
37 Convert Binary Number in a Linked List to Integer
38 Reverse Linked List
39 Linked List Cycle
40 Partition List
41 Palindrome Linked List
42 Middle of the Linked List
43 Remove Duplicates from Sorted List
44 Merge Two Sorted Lists
45 Reverse Linked List II
46 Insertion Sort List
47 Remove Duplicates from Sorted List II
48 Remove Nth Node From End of List
49 Simplify Path
50 Rotate List
51 Next Greater Element I
52 Linked List Cycle II
53 Remove Outermost Parentheses
54 Remove All Adjacent Duplicates In String
55 Baseball Game
56 Evaluate Reverse Polish Notation
57 Add Two Numbers(Link List)
58 Make The String Great
59 Swap Nodes in Pairs
60 Reorder List
61 Min Stack
62 Backspace String Compare
63 Pow(x, n)
64 Subsets
65 Permutatations
66 String Compression
67 Count of Matches in Tournament
68 Combinations
69 Combination Sum
70 Subsets II
71 Letter Combinations of a Phone Number
72 Rotate String
73 Generate Parentheses
74 Two Sum
75 Sliding Window Maximum
76 Permutation in String
77 Rotate Image 1. Swap along x axis line then Transpose matrix (y=x line) (clockwise rotation)
2. Swap along y axis line then Transpose matrix (y=x line) (anti-clockwise rotation)
78 Maximum Length of a Concatenated String with Unique Characters
79 Daily Temperatures
80 Combination Sum II
81 Maximum XOR of Two Numbers in an Array
82 Count Number of Nice Subarrays
83 Largest Rectangle in Histogram
84 Dinner Plate Stacks
85 Implement Queue using Stacks
86 Longest Substring Without Repeating Characters
87 Word Search
88 XOR Operation in an Array
89 Palindrome Partitioning
90 Maximum Subarray
91 Range Sum of BST
92 4Sum
93 Valid Anagram
94 Sort Colors
95 Valid Anagram
96 Gray Code
97 Validate Binary Search Tree
98 Valid Sudoku
99 Group Anagrams
100 Permutation Sequence
101 Copy List with Random Pointer
102 Binary Tree Inorder Traversal
103 Minimum Window Substring
104 Longest Substring Without Repeating Characters
105 Invert Binary Tree
106 Binary Tree Inorder Traversal
107 Binary Tree Preorder Traversal
108 Binary Tree Postorder Traversal
109 N-Queens
110 Maximum Depth of Binary Tree
111 Minimum Depth of Binary Tree
112 Same Tree
113 Word Pattern
114 Symmetric Tree
115 Sum Root to Leaf Numbers
116 Path Sum
117 Kth Smallest Element in a BST
118 Merge Two Binary Trees
119 Binary Tree Level Order Traversal
120 Binary Tree Right Side View
121 Binary Tree Level Order Traversal II
122 Binary Tree Paths
123 Path Sum II
124 Balanced Binary Tree
125 Maximum Level Sum of a Binary Tree
126 Convert Sorted Array to Binary Search Tree
127 Construct Binary Search Tree from Preorder Traversal
128 Bulb Switcher
129 Convert Sorted Array to Binary Search Tree
130 Construct Binary Tree from Inorder and Postorder Traversal
131 Implement strStr()
132 Maximum Product of Three Numbers
133 Binary Search Tree Iterator
134 Two Sum IV - Input is a BST
135 Flatten Binary Tree to Linked List
136 Binary Tree Zigzag Level Order Traversal
137 Lowest Common Ancestor of a Binary Tree
138 Cousins in Binary Tree
139 Implement Trie (Prefix Tree)
140 Longest Word in Dictionary
141 Merge k Sorted Lists
142 Minimum Distance Between BST Nodes
143 Vertical Order Traversal of a Binary Tree
144 Diameter of Binary Tree
145 Subarrays with K Different Integers
146 Distribute Candies
147 Sudoku Solver
148 Jump Game
149 Gas Station
150 Unique Paths
151 Decode Ways
152 Number of Ways to Paint N × 3 Grid
153 Best Time to Buy and Sell Stock II
154 Unique Binary Search Trees
155 Jump Game II
156 Maximum Product Subarray
157 Maximum Points You Can Obtain from Cards
158 Maximum Subarray
159 Product of Array Except Self
160 Counting Bits
161 https://leetcode.com/submissions/detail/567415808/
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
X Tutup