Coding_Notes_SDE_Blind75_Neetcode_Ashhad
Coding_Notes_SDE_Blind75_Neetcode_Ashhad
https://www.youtube.com/watch?v=34WE6kwq49U
https://leetcode.com/problems/best-time-to-buy-and-sell-stock/solutions/3914105/most-optimized-
solution-easy-to-understand-c-java-python/
a= [5,2,6,1,4]
https://leetcode.com/problems/two-sum/solutions/3619262/3-method-s-c-java-python-beginner-
friendly/
Two Sum: Complexity O(nlogn) if we use a map O(n) if we use unordered map in best and average
case O(N^2) in worst case
JAVA
Python
Problem 3: https://leetcode.com/problems/product-of-array-except-self/description/
Problem 4:
https://leetcode.com/problems/contains-duplicate/description/
https://leetcode.com/problems/contains-duplicate/solutions/3672475/4-method-s-c-java-python-
beginner-friendly/
Below solution works for all tc’s but TLE error for really big arrays.
Optimized solution:
Binary:
https://leetcode.com/problems/reverse-bits/solutions/5215314/reverse-bits-easy-o-1-solution-with-
0ms-runtime/
https://leetcode.com/problems/reverse-bits/solutions/1232842/java-c-0ms-o-1-time-complexity-in-
place-detailed-explanation/
Problem 2: https://leetcode.com/problems/sum-of-two-integers/
https://leetcode.com/problems/sum-of-two-integers/solutions/4326325/c-beats-100-bit-
manipulation-maths/
Problem 3: https://leetcode.com/problems/reverse-integer/
Problem 4: https://leetcode.com/problems/powx-n/
If we use for(int i=0;i<n;i++) here it will give TLE
https://leetcode.com/problems/powx-n/solutions/3206602/best-c-5-solution-math-recursion-brute-
force-optimize-one-stop-solution/
Problem 5: https://leetcode.com/problems/happy-number/
https://leetcode.com/problems/happy-number/solutions/2969127/fastest-c-solution-using-
recursion/
Problem 6: https://leetcode.com/problems/plus-one/solutions/
https://leetcode.com/problems/plus-one/solutions/5036558/beats-100-runtime-and-54-32-
memory-c-easy-to-understand/
Matrix:
Problem 1: https://leetcode.com/problems/rotate-image/description/
Problem 2: https://leetcode.com/problems/set-matrix-zeroes/
https://takeuforward.org/data-structure/set-matrix-zero/
Extra Space:
No extra Space and using 0th row and 0th column to store flags but the thing is that matrix[0][0]
element is common for both 0th row and 0th column . So to avoid 0th column to become 0 due to 0
obtained from other columns in the first row(other than 0) we use col0 variable to track first column.
Strings:
Problem1: https://leetcode.com/problems/valid-anagram/
JAVA:-
Question 2: https://leetcode.com/problems/valid-palindrome/description/