the if block will never occur because you sort your digits but then you compare it to the "check" array which has 0 at the end of the array and not the start.
Thanky you! I was approaching the problem as if it was just looking for the total number of results that contain d, not the total number of times d appears.
if you look up the (connect the ropes to minimise cost) it is much better explained there and will remove confusion because many people think for numbers [1,2,3,4,5] the minimal cost is 34 but it is actually 33'
can u give me a hint of how to solve this ,i had done but test returned it took more time
the if block will never occur because you sort your digits but then you compare it to the "check" array which has 0 at the end of the array and not the start.
This comment is hidden because it contains spoiler information about the solution
thank you
Maths behind this problem is very interesting. Cool Kata!
Thanky you! I was approaching the problem as if it was just looking for the total number of results that contain d, not the total number of times d appears.
Thanks!
Enjoyed this kata, good job!
if you look up the (connect the ropes to minimise cost) it is much better explained there and will remove confusion because many people think for numbers [1,2,3,4,5] the minimal cost is 34 but it is actually 33'