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.
Also note that it technically isn't "constant time", as operations like addition, subtraction, multiplication, and square root need more than "constant time" to compute.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Halloween Sale
You are viewing a single comment's thread. Return to all comments →
It's a bit tricky, but I've solved it that way. https://www.hackerrank.com/challenges/halloween-sale/submissions/code/67937852
Also note that it technically isn't "constant time", as operations like addition, subtraction, multiplication, and square root need more than "constant time" to compute.