HackerRank
HackerRank copied to clipboard
Greedy/Sherlock and the Beast is a Diophantine equation which can be solved without loops.
I have implemented this solution in Go in this PR: https://github.com/RyanFehr/HackerRank/pull/239
You guys might want to update the java solution to match. :)
I would also note that the mathematical solution is O(1), not O(n) like the currently listed solution.