
Asked in Oracle
Square Root (Integral) Problem Statement
Given a number N
, calculate its square root and output the integer part only.
Example:
Input:
18
Output:
4
Explanation:
The square root of 18 is approximately 4.24. The integer part is 4.
Constraints:
0 ≤ N <= 108

AnswerBot
4mo
Calculate the integer square root of a given number.
Use binary search to find the square root of the number.
Start with a range from 0 to N, and iteratively narrow down the range until you find the int...read more
Kamakshi Dhankar
2y
import java.util.Scanner ;
public class Main {
public static void main(String[] args) {
// Write your code here
int i = 1 , result =1 ;
Scanner s = new Scanner(System.in);
int N = s.nextInt();
while(result<=N) {
i++ ;
result = i*i ;
}
System.out.println( i- 1 );
}
}
Help your peers!
Add answer anonymously...
Top Software Developer Interview Questions Asked at Oracle
Q. How do you create thread locks?
Q. Design a parking lot.
Q. What is testing? Explain the different types of testing.
Interview Questions Asked to Software Developer at Other Companies
Top Skill-Based Questions for Oracle Software Developer
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

