RAINWATER HARVESTING QUESTION

When i see the problem statement of this question, the brute force approach comes in my mind , but when i see the editorial of this problem, then i came to know about more better approaches than this,…
So, i want to ask you how we think of these better approaches of some problem??

@CODER_JATIN it only happens by practice like if you do many questions based on a particular app lets say binary search then it will automatically strike you when a question have to do something related to it .
only thing to become better is not loose patience and keep practising (dont get demotivated and all if you suffer at first)

ok ji, thank you so much . . .

@CODER_JATIN you are welcome