We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Manasa and Sub-sequences
Manasa and Sub-sequences
Sort by
recency
|
8 Discussions
|
Please Login in order to post a comment
Anyone has any ideas for optimizing my code in Java ? I have failed for the 2 last tests..
We have to find out the summation of all subset number of a given number . So , let's find a pattern which will give us the idea to work out the solution . Assume given number abc
My code https://github.com/joy-mollick/Problem-Solving-Solutions-Math-Greedy-/blob/master/HackerRank-Manasa%20and%20Sub-sequences.cpp
Hi @levpolka ,
Can you please explain how you get this formula by looking at quetion.
My formula :
10a + b ---> 11a + 2b
100a + 10b + c ---> 11(11a + 2b) + 4c
1000a + 100b + 10c + d ---> 11(11(11a + 2b) + 4c) + 8d
And so on.
Hmm powers of 11 and powers of 2 sure are handy for solving this.