Help me solve this hackerrank problem.

combinatorics
dps
hackerrank

#1

This hackerrank problem was asked in last week of code, I am having a hard time understanding it’s editorial, please help me solve it.


#4

Thank you so much for the explanation and I have doubt.If you don’t mind can you explain your calculation part in your code in the “while loop”.Please

Thank You!


#5

I was not able to think of compression of values, and that got me :frowning: . Can you share your code as well? It can clear the implementation doubts !! :slight_smile:


#6

@vijju123 this is his code.
link:
https://www.hackerrank.com/rest/contests/w34/challenges/same-occurrence/hackers/Vasja_Pavlov/download_solution


#7

Wait, hackerrank allows you to see others solution?? Since when? O_O


#8

After the contest :slight_smile:


#9

Damn! I never knew that :confused: . It allows you to view others solution in practice section too?


#10

Yes @vijju123


#11

I edited a para of your answer for clarity. The * * were causing unnecessary italics. Have a check at it :slight_smile: