Day-14
#SDESheetChallenge
Linked List & Arrays Done
✅Trapping Rainwater: two pointers with max boundaries O(n)
✅Remove Duplicates from sorted array: two pointers O(n)
✅Maximum Consecutive Ones: count and reset if visit 0 O(n)
@striver_79@takeUforward_#45DaysOfCode#DSA
Day-13
#SDESheetChallenge
Linked List & Arrays
✅Rotate a LL: length connect break O(n)
✅Clone a LL with random and next pointer: insert new nodes in b/w og nodes, later separate the lists O(n)
✅3 Sum: sort two pointers O(n²)
@striver_79@takeUforward_#45DaysOfCode#DSA
Day-12
#SDESheetChallenge
Linked List II Done
✅Check if LL is palind. or not: middle reverse compare O(n)
✅Find the starting pt. in LL: Floyd's cycle with reset pointer O(n)
✅Flattening of LL: merge sorted lists recursively O(n*m)
@striver_79@takeUforward_#45DaysOfCode#DSA
Day-11
#SDESheetChallenge
Linked List II
✅Find the intersection of Y LL: pointers switching O(n m)
✅Detect a loop in LL: Floyd's cycle(slow n fast) O(n)
✅Reverse LL in group of K: k-wise reversal with pointers adjustment O(2n)
@striver_79@takeUforward_#45DaysOfCode#DSA
Day-10
#SDESheetChallenge
Lined List I Done
✅Remove Nth node from the back of the LL: fast n slow two pointers O(n)
✅Add two numbers as LL: digit-wise carry while traversing O(max(m, n))
✅Delete Node in a LL O(1): copy next node
@striver_79@takeUforward_#45DaysOfCode#DSA
Day-9
#SDESheetChallenge
Linked List Problems
✅Reverse a LL: maintaining prev, curr, next node pointers O(n)
✅Find Middle of LL: slow n fast pointer O(n/2)
✅Merge two Sorted Lists: visiting each node of both lists once O(n m)
@striver_79@takeUforward_#45DaysOfCode#DSA
These problems helped understanding the use of extra space(for reducing the time for lookup using map and set) and approach like two pointer for better time complexities.
I was just about to leave this challenge today, but I didn't. I showed up and am happy about it.
Btw these problems were very interesting and intuitive
Day 2
#SDESheetChallenge Done
Array Problems
✅Kadane's Algo: max subarray sum (-ve, ve ele) O(n)
✅Sort array of 0, 1 & 2: dutch national flag using 3 pointers O(n)
✅Best time to buy & sell stock: track highest price from back O(n)
@takeUforward_@striver_79#DSA#45DaysOfCode