### Leetcode 1. Two Sum

once we fix one number, say K, then we know what the other number must be and i.e. target-K. For any other number, they won’t add up to the target. Now if we know that search is a vital operation, employ the best data structure for the search i.e. hash set. … More Leetcode 1. Two Sum

### Leetcode #1529: Bulb Switcher IV

Certainly, a “Flip” is a must when the current status of a bulb at index i and it’s the target status are not the same.

Initially all bulbs are OFF i.e. 0 and when a bulb at index i is flipped, every bulb after (in the right -> direction) that bulb gets flipped. So it only makes sense to start getting the status of the bulbs correct int the left to right order. … More Leetcode #1529: Bulb Switcher IV

### Leetcode #1488: Avoid Flood in The City

When drying lake #L, it is only useful to dry it if it is FULL already. Otherwise, it’s just a waste to dry an empty lake. (Explained this in the code with a small example as well). In short, drying a lake #L only makes sense if it is already FULL and it is going to rain on that lake in future.

Which lake to dry on a day when there is no rain, can not be determined without knowing the rain sequence that is coming next. … More Leetcode #1488: Avoid Flood in The City

### Leetcode #1419: Minimum Number of Frogs Croaking

For example, say at t=0, t=1, and t=2, the number of frogs that are croaking is 1, 2, and 1 respectively. Finding how many frogs are croaking at any time is also not difficult. We know that each “croaking” starts with a ‘c’ and ends with a ‘k’. … More Leetcode #1419: Minimum Number of Frogs Croaking