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.
It was only after my first C++ solution passed all the test cases that I saw this comment in the discussion. It prompted me to refine my solution to eliminate the division and modulo operations. It seems necessary to make a small addition to the linear space factor to do so, and whether that extra space is worth the arithmetic complexity reduction seems like a weird trade-off in an algorithm that uses standard allocators.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Count Triplets
You are viewing a single comment's thread. Return to all comments →
It was only after my first C++ solution passed all the test cases that I saw this comment in the discussion. It prompted me to refine my solution to eliminate the division and modulo operations. It seems necessary to make a small addition to the linear space factor to do so, and whether that extra space is worth the arithmetic complexity reduction seems like a weird trade-off in an algorithm that uses standard allocators.