DSAALGO
.
Top 5
Algorithms .
1 .
K elements
Top .
1. K largest
Find or smallest numbers in Adday
an
.
.
2
FindK frequent .
number
3
. use
Heap of size K and insert one
by one element
from at the end
Heap contains only required
array ,
elements .
window
2 .
Sliding
I without repeating characters
.
Longest substring .
.
2 Maximum Sum of Distinct
subarrays with
Length K .
.
3 Find the longest substring with kunique characters in a
given string
.
4
.
Dynamic programming.
.
Prompt used
Explain the how to implement dynamic programming with bullet points so that it
will be helpful for revision
https://chat.openai.com/share/7583c774-54c1-409f-bc21-2ab93eca9853
https://chat.openai.com/share/b46c6fd0-7908-4655-9ca6-7b634d319d08
https://chat.openai.com/share/9478627a-ae6c-4ba9-b748-d812727235e0
1
Arrays
.
1 .
] 48
. Rotate Matric -
> Leetcode .
soli 1 .
Transpose the matric.
↳ swap the
diagnol .
elements
.
2 Reverse the matric
and ele in
↳ swap the left right a 2010
.
Leetcode
2) 56 Merge Intervals
+ .
Soni7 in DSASHEET REVISION-ChatGPT .
3) COT ·
Find the Duplicate Number .
soll) Slow fast approach
linked list
↳
cycle kind of poblm
↳ use
floy's algo to
get
beggining of the cycle of linked list
&
↳ Slow by 1 pointer moves step.
↳
fast Lpointer moves by 2 step
and
↳ slow
fast pointer intersect at one point
.
↳ Then set slow
pointed to the beggingig
.
↳
fast pointer is at same intersected point
and
faster pointer by
↳ more slow
now
Step
one
and that is the
↳
again slow
and fast pointer intersect at one
point ans