All Posts

1276 articles

dsa1 min read

Gas Station — Greedy Circular

Find starting gas station index to complete circular route. If total gas >= total cost, a solution exists. Track running balance; reset start when negative.

Read →
dsa1 min read

Candy — Two-Pass Greedy

Distribute minimum candies with higher-rated children getting more than neighbors. Two-pass: left-to-right for ascending, right-to-left for descending.

Read →
Page 53 of 256