
JumpyJellybean
I'm practicing Dsa for 3 months now.Having a doubt,how to approach a problem involving subarrays
WHICH APPROACH TO CHOSE AND WHY? 1.Prefix sum 2 Kadane's algo. 3.Sliding window 4.Hashing
24mo ago
Jobs
One interview, 1000+ job opportunities
Take a 10-min AI interview to qualify for numerous real jobs auto-matched to your profile 🔑+322 new users this month

MagicalQuokka
Stealth24mo
Do quick dry runs on paper and finally choose the one which is working. Over time, you'll get better at picking the correct approach in one go.
Sliding window problems are very easy to identify due to their sliding nature.
Based on number of problems in categories, I think probability-wise it makes sense to go for hashing > something using stacks > two pointers > prefix sum > Kadane's
Discover more
Curated from across