How did we come to the numbers 3 and 4 ? Any such question available online ?
You’ve asked this question on Reddit: Reddit - Dive into anything
See my response there.
Will be O(2^(mn)) - iykyk
- that’s just a bruteforce solution
- you can reduce this to O(mn) using DP (dynamic programming)
- the complexity when you use combinatorics is even lower, and
- what you’re saying is out of scope of the GRE anyway
