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.
Sherlock and The Beast
Sherlock and The Beast
Sort by
recency
|
542 Discussions
|
Please Login in order to post a comment
C++
A few problems with this task 1) For n=15 both could work all 5 or all 3 but test just expect it to be all 5 2) 33333555 and 55533333 are valid solutions but again test expect it to be 55533333 3) for n = 100 there more then one solution it could be 10 times 5 and 90 times 3 but also could be 85 times 3 and 15 times 5
All in all i've decided to not proceed because it doesn't make sense find all of the limitations that not descripbed in the Problem section.
`
python 3
Here is my c++ solution, you can have the implementation link here : https://youtu.be/R01NQ4Zt2qA
My Java solution with o(n) time complexity and o(1) space complexity: