Practice Lab

Solved Problems

ProblemPatternLanguageDifficultyStatusNotes
Subarray Sum Equals KPrefix sum countsJavaMediumSolved and tunedCount earlier prefix sums equal to currentPrefix - k.
Two SumHash map complement lookupJavaEasySolved and tunedOne-pass map from seen value to index.
Valid ParenthesesStack matchingJavaEasySolved and tunedClosing bracket maps to expected opening bracket.
Remove All Adjacent Duplicates In StringStack cancellationJavaEasySolved and tunedCancel the current character with the latest kept matching character.
Remove All Adjacent Duplicates In String IIStack with run countsJavaMediumSolved and tunedCompress adjacent runs and pop when a count reaches k.
Daily TemperaturesMonotonic stackJavaMediumSolved and tunedStore unresolved day indices until a warmer day appears.
Merge IntervalsSort intervals + scanJavaMediumSolved and tunedSort by start, then merge overlapping ranges.
Same TreeRecursive tree comparisonJavaEasySolved and tunedCompare null cases, node value, then left and right subtrees.
Binary Tree PathsDFS path buildingJavaEasySolved and tunedCarry the current root-to-node path and save it at each leaf.
Jump GameGreedy farthest reachJavaMediumSolved and tunedTrack the farthest reachable index; fail when the current index is beyond it.
3SumSort + fixed index + two pointersJavaMediumSolved after TLE analysisBrute force O(n^3) timed out; optimized to O(n^2).
Best Time to Buy and Sell StockTrack minimum so farJavaEasySolved and tunedOne transaction: best sell today minus cheapest prior buy.
Best Time to Buy and Sell Stock IIGreedy positive differencesJavaMediumSolved and tunedRising-run scan simplified to summing every positive daily gain.
Find Pivot IndexPrefix sum balanceJavaEasySolved and tunedCompare left sum with total minus left sum and current value.
Rank Transform Of An ArraySort copy + rank mapJavaEasySolved and tunedAssign ranks to distinct sorted values, then map the original order.