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.
I don't like the categorization of this problem as recursion. Some of the test cases are so huge that recursion causes stack overflows / timeouts in many languages (I tried both JS and Python). This modulus solution is great, but it's a little misleading to ask you to write it recursively when this solution is so much more elegant.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Recursive Digit Sum
You are viewing a single comment's thread. Return to all comments →
I don't like the categorization of this problem as recursion. Some of the test cases are so huge that recursion causes stack overflows / timeouts in many languages (I tried both JS and Python). This modulus solution is great, but it's a little misleading to ask you to write it recursively when this solution is so much more elegant.