Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Problem of the day

You are given an integer ‘A’. Your task is to find the greatest non-negative integer whose square is less than or equal to ‘A’.

Square of a number is the product of the number with itself. For e.g. square of 3 is 9.

Detailed explanation

```
2
8
9
```

```
2
3
```

```
The greatest non-negative integer for test case 1 whose square is less than equal to 8 is 2 as the square of 3 is 9 which is greater than 8.
The greatest non-negative integer for test case 2 whose square is less than equal to 9 is 3 as the square of 4 is 16 which is greater than 9.
```

```
2
1
0
```

```
1
0
```

```
1 <= T <= 10^4
0 <= A <= 10^5
Time Limit: 1 sec
```

```
Time Complexity : O(log(n))
Space Complexity : O(1)
```