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.
Sherlock and Squares
Sherlock and Squares
Sort by
recency
|
1581 Discussions
|
Please Login in order to post a comment
Javascript simple solution: function squares(a, b) { const lower = Math.ceil(Math.sqrt(a)) const upper = Math.floor(Math.sqrt(b)) return upper-lower+1
}
Java solution :
Easiest Javascript solution without any loop:
Here is problem solution in Python, Java, C++, C and Javascript - https://programmingoneonone.com/hackerrank-sherlock-and-squares-problem-solution.html