Day - 11 #SDESheetChallenge done!!
Approach in ques:-
Q1. Head Switch technique
Q2. fast and slow pointers
Q3. reverse k - groups
@takeUforward_@striver_79 linked list-2 kicked off🚀
Day - 10 #SDESheetChallenge done!
Approach in ques:-
Q1. slow and fast pointers
Q2. Digit-by-Digit Addition (with carry)
Q3. Overwrite & Skip
@takeUforward_@striver_79 with this linked list revision done! 🥳
Day-9 #SDESheetChallenge done!!
Approach in ques:-
Q1. Dummy comparison
Q2. slow and fast pointers
Q3. Floyd's Cycle Detection Algorithm
@takeUforward_@striver_79 way to next day🙌
Day - 8 #SDESheetChallenge🫡
Approach in ques:-
Q1. Prefix Sum HashMap
Q2. Prefix XOR HashMap Frequency
Q3. Sliding Window HashSet.
@takeUforward_@striver_79 way to other day!!
Day-7 #SDESheetChallenge done!!
Approach in ques:-
Q1. Use a HashMap , check if target - num already exists.
Q2. Sort the array. Fix first two numbers using nested loops, then use two pointers.
Q3. use hashset ,start from (num-1) doesn't exist, then count forward.
@takeUforward_
ALT Q1. Two Sum
HashMap stores value → index.
Find complement (target - num) while traversing.
Q2. 4Sum
Sort array and fix first two numbers.
Use two pointers for remaining pair, skip duplicates.
Q3. Longest Consecutive Sequence
Store all numbers in HashSet.
Start from sequence beginnings and count forward.
Day-6 #SDESheetChallenge 🫡
Approach in ques:-
Q1. extended Boyer-Moore Voting Algorithm
Q2. recursion with memoization
Q3. Merge Sort. While merging two sorted halves, count pairs using two pointers. Then merge normally.
@takeUforward_@striver_79 🙌
ALT Q1. majority element
use Boyer-Moore Voting to find up to two potential elements occurring more than n/3 times.
Verify both candidates by counting their actual frequencies in a second traversal.
Q2. unique paths
From each cell, recursively explore moving right and down until reaching the destination.
Use memoization (DP) to store previously computed results and avoid repeated calculations.
Q3. reverse pairs
Apply Merge Sort to divide the array into sorted halves recursively.
During merging, use two pointers to count pairs satisfying arr[i] > 2 × arr[j] efficiently.
Day-5 #SDESheetChallenge 🫡
Approaches in ques:-
Q1. Apply Binary Search on indices,Compare and shrink search space.
Q2. Binary Exponentiation
Q3. Boyer-Moore Voting Algorithm
@takeUforward_@striver_79 way to next day!
ALT Q1. Search a 2D Matrix: Treat the matrix as a sorted 1D array and perform Binary Search. Convert the middle index into row and column coordinates to access elements efficiently. T.C: O(log(m×n)), S.C: O(1).
Q2. Pow(x, n): Use Binary Exponentiation by repeatedly squaring the base and processing exponent bits. Multiply the answer when the current bit is set and handle negative powers using reciprocals. T.C: O(log n), S.C: O(1).
Q3. Majority Element: Apply Boyer-Moore Voting. Maintain a candidate and count; matching elements increase count, mismatches decrease it. The remaining candidate is guaranteed to be the majority element. T.C: O(n), S.C: O(1).
Day-4 #SDESheetChallenge done🫡
Solved 3 classic problems today 🚀
Approaches:-
Q1. fast and slow pointers
Q2. hashset to find duplicates, then find the missing number
Q3. Merge Sort ,count inversions during merge
@takeUforward_ to the next one!
ALT 1. Find Duplicate Number → Floyd’s Cycle Detection (slow/fast pointers), treating the array as a linked list. O(n) time, O(1) space.
2. Missing & Repeated Value → HashSet to detect duplicate, then find the missing number. O(n²) elements, O(n²) space.
3. Inversion Count → Merge Sort; count inversions during merge when a right element goes for remaining left elements. O(n log n).
Day-3 #SDESheetChallenge done!!
Revised all the three questions.
Approaches:
Q1. transpose then reverse rows
Q2. sort then greedy merge
Q3. three pointers from end
@takeUforward_@striver_79
ALT 1. Merge Sorted Array
Start from the end of both sorted arrays.
Place the larger element at the last available position in nums[i].
2. Merge Intervals
Sort intervals by their start time.
Merge intervals whenever the next interval overlaps with the current one.
3. Rotate Image
Transpose the matrix (convert rows to columns).
Reverse each row to achieve a 90° clockwise rotation.
besides the sde sheet.
got some hands on dp questions
this lcs type is one hell of interesting question.
approach:- refer to this link 👇
leetcode.com/problems/wildca…