Dsa
Math
Medium
Count of Perfect Squares
Given a positive integer n, count how many perfect square numbers are less than or equal to n. Print the count.
### Input Format:
A single integer n (1 <= n <= 10^6).
### Output Format:
A single integer representing the count of perfect squares less than or equal to n.
### Example:
Input:
15
Output:
3
### Explanation:
The perfect squares less than or equal to 15 are 1, 4, and 9 (i.e., 1^2, 2^2, 3^2). Thus, the count is 3.
Key concepts
mathsquarescounting
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now