Can anyone explain their approach to solve the problem DEVVOTE, in the given time limits.

In the first 2 pages, of submission, I only found one person who actually got the problem accepted without hard-coding the values.

5 Likes

@karanaggarwal: you can solve the question in entire poly(n) time Authorâ€™s and testerâ€™s solution are of online numberOfpartitions(n) * poly(n). I infact, did not increase constraints because I was expecting a lot of online solutions

1 Like

@dpraveen , I just used the following assumptions without loss of generality ,

- occurence of New numbers in increasing order .
- occurence of previous numbers for same count in increasing order.

Was there any other Asymptotical optimisation involved ?

My worst case soln i.e. 36 cases for n = 36 each took around 12 seconds , with very - unoptimised implementation though .

What was the complexity of the solution you used to hardcode the answers ?

1 Like

My similar implementation took 2-3min for n=36