Quantcast
Channel: Javalobby - Code Puzzler
Viewing all articles
Browse latest Browse all 59

Code Puzzler Response - Find the Integer Square Root of a Positive Integer

$
0
0
This Code Puzzler comes from the community contributor - Erik ColbanThanks, Eric for today's extra brain-teaser!Write a function that calculates the integer square root of any positive integer, but only uses add, subtract, left and right shifts, but no division or multiplication. The algorithm must run in O(log n) time. By integer square root I mean the largest integer whose square is less than...

Viewing all articles
Browse latest Browse all 59

Trending Articles