GOKOOL and his STUDIES
PROBLEM CODE: GKST
The question says that Gokool will study a set topics in a particular pattern. Only if the difficulty of the subject on that day is greater than the difficulty of the subject he studied the earlier day.
This is a direct implementation of Longest Increasing Sequence. The difficulty of the topics Gokool studies should always be in an increasing manner.
As the size of the test cases are small, the question can be approached in a brute approach. Checking all combinations is called brute approach for this method.
In the brute approach each topic can be considered as STUDIED or NOT STUDIED. In this manner, we can find the most number of topics Gokool can study.
Time Complexity :
O(2^n) -> Brute
O(n*log(n)) -> Dynamic Programming
Setter’s solution : Solution