Observation: Number of techniques for each of them depends on the number of techniques they had in the previous meet. So, it becomes a linear recurrence
Solution: If you brute force it, it will surely get a TLE as the complexity for that is O(T×n) and as there is no pattern in the recurrences we can solve this problem with matrix exponentiation. The complexity of the solution becomes O(T×LogN).


69% Solution Ratio
alamkhanEarliest, Apr '21
Yasir_ArafatFastest, 0.0s
alamkhanLightest, 131 kB
steinumShortest, 1028B
Toph uses cookies. By continuing you agree to our Cookie Policy.