Variations of leetcode questions

I get difficulty in answering questions that are variations of leetcode questions. Can anyone suggest me ways to improve on it. Asking variations is becoming increasingly common these days especially if we consider top tier companies. I had solved stock related questions 121,122,123 but i was being asked 714 and I started off with following approaches in earlier stock questions with some modifications but was not able to make it. Later after reading discuss section , I realized that there is a dp followed by 2 variable optimization.

Comments (1)