bitteregithubpostsphotos

You are given an array of non-negative integers height which represent an elevation map. Each value height[i] represents the height of a bar, which has a width of 1.

Return the total amount of water that can be trapped between the bars.

admittedly, not the most difficult problem, but definitely not an easy one either. as someone who is just getting into competetive programming, solving this (and finally getting the optimal solution) did indeed feel good, but it also reminded me of something.

coming from jee

jee is india’s national engineering entrance exam, for entry into the country’s top engineering institutes: iits and nits. although, other institutes also accept admissions based on your jee scores.

i would say jee is mostly just:

  1. learning lots of different methods
  2. finding patterns where the method is useful
  3. fast numerical calculation

when i was solving the “trapping rain water” problem, i felt a lot of the same things going through my mind as if i was solving another jee problem: finding the pattern that revealed that the optimal solution would use a dynamic sliding window, applying that method and then doing some additional calculations along the way.

its also a little refreshing to see that the learning systems i’ve built along the way while preparing for jee are coming handy when practicing these competetive programming problems as well.

alright, i’m gonna get back to doing some assignments and stuff.

back