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.
- Prepare
- Data Structures
- Advanced
- Cube Summation
- Discussions
Cube Summation
Cube Summation
Sort by
recency
|
81 Discussions
|
Please Login in order to post a comment
Great post
Absolutely OO overkilled this in Java, but I had a fun time doing it. Note: The sums generated exceed what a 32-bit int can handle. You will need to alter the code provided to use Longs instead of Integers if you notice your results rolling around due to overrun.
All tests passed. Not sure about efficiency; Rolled my own data-nodes. Tried to use TreeSets to do "just in time" node creation and to skip over empty slots during summation.
Considering some python specifics, this is quite easy: