Taking 100 days of code Challenge #100DaysOfCode
posting regularly for accountability.
Targets:
#Strike DSA, #Strike Gen AI (JS too) -- Main frame.
Frontend Dev (React), LC daily problems+contests.
I will be sharing the notion notes i make
this is #day 0/100
@rohit_negi9
796.Rotate String
🔹Rotation = leftmost char goes to end (left shift).
🔹At most n distinct rotations exist for string length n.
🔹way1 : rotate up to n times + compare ⇒ O(n²), O(1).
🔹way2: if goal is in (s+s) ⇒ rotation exists⇒O(n) time.
https://t.co/TyaX7xDOlh
796.Rotate String
🔹Rotation = leftmost char goes to end (left shift).
🔹At most n distinct rotations exist for string length n.
🔹way1 : rotate up to n times + compare ⇒ O(n²), O(1).
🔹way2: if goal is in (s+s) ⇒ rotation exists⇒O(n) time.
https://t.co/TyaX7xDOlh
Initialize count = 0
For each x from 1 to n:Set changed = false
While x > 0:d = x % 10
If d is 3 or 4 or 7: mark invalid, stop and say “not good”
If d is 2 or 5 or 6 or 9: set changed = true
x = x / 10
If number was valid AND changed == true: count++
Return count
Initialize count = 0
For each x from 1 to n:Set changed = false
While x > 0:d = x % 10
If d is 3 or 4 or 7: mark invalid, stop and say “not good”
If d is 2 or 5 or 6 or 9: set changed = true
x = x / 10
If number was valid AND changed == true: count++
Return count
396. Rotate Function
• We need the max of F(k) = sum(i * arr_k[i]) over all rotations.
• Derive: F(k+1) = F(k) + Sum - n *lastElement(arr_k).
• Without rotating, lastElement(arr_k) = nums[n-1-k].
• Get S and F0 once, then iterate to get all F(k) in O(n) and track the maximum.
396. Rotate Function
• We need the max of F(k) = sum(i * arr_k[i]) over all rotations.
• Derive: F(k+1) = F(k) + Sum - n *lastElement(arr_k).
• Without rotating, lastElement(arr_k) = nums[n-1-k].
• Get S and F0 once, then iterate to get all F(k) in O(n) and track the maximum.
Your all efforts are being stored somewhere, even if you can't see any growth,
🔸They will all reflect someday
🔸And, it will look like an OVERNIGHT SUCCESS......
#lec 46: Problems on Next Greater Element
Strike DSA by @rohit_negi9 bhaiya
🔹Next Greater Element in Circular Array
🔹Next Smaller Element
🔹Previous Greater Element
🔹Next Smaller Element on Left
🔹Next Greater Element II
🔹Stock Span Problem
🔹Largest Rectangle in Histogram
#lec 48: Problems on Queue
Strike DSA by @rohit_negi9 bhaiya
Qs
🔹Generate Binary Numbers
🔹Implement Stack using Queues
🔹Implement Queue Using Stacks
🔹First negative in every window of size k
#lec 47: Intro to Queue
Strike DSA by @rohit_negi9 bhaiya
Th
🔹Implementation by array
🔹Operations on Queue
🔹Need of circular Queue
🔹Implementation by LL
Qs
🔹Queue Reversal
🔹Reverse first K of a Queue
🔹Time Needed to Buy Tickets
#lec 47: Intro to Queue
Strike DSA by @rohit_negi9 bhaiya
Th
🔹Implementation by array
🔹Operations on Queue
🔹Need of circular Queue
🔹Implementation by LL
Qs
🔹Queue Reversal
🔹Reverse first K of a Queue
🔹Time Needed to Buy Tickets
#lec 46: Problems on Next Greater Element
Strike DSA by @rohit_negi9 bhaiya
🔹Next Greater Element in Circular Array
🔹Next Smaller Element
🔹Previous Greater Element
🔹Next Smaller Element on Left
🔹Next Greater Element II
🔹Stock Span Problem
🔹Largest Rectangle in Histogram
Taking 100 days of code Challenge #100DaysOfCode
posting regularly for accountability.
Targets:
#Strike DSA, #Strike Gen AI (JS too) -- Main frame.
Frontend Dev (React), LC daily problems+contests.
I will be sharing the notion notes i make
this is #day 0/100
@rohit_negi9