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.
Stone Division, Revisited
Stone Division, Revisited
Sort by
recency
|
63 Discussions
|
Please Login in order to post a comment
code for java7:
My C program prints correct result in test run (see below for Test Case 1), But after I submit it, it failed the Test Case 1. What did I do wrong?
I have been testing using the C-code base. I inserted the following simple code:
I compiled it on my RedHat 8.7 system. When I run it with the test input, it cored (tmp.c is the C-code base + above 4 lines of code):
Looks like there is some issue with the original C-code base.
C++
This problem permits a really short recursive solution.
Generally I prefer non-recursive approaches, as recursion tends to be slow (even with memo) and recursion depth limits may apply. However recursive solutions give more concise and elegant code.
Python3: