Grokking the Art of Recursion for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
6. Perfect Square
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Problem Statement

Write a Recursive Solution to Check if a Given Number is a Perfect Square or Not.

The problem is to determine whether a given positive number is a perfect square or not. A square number or perfect square is an integer that is the square of an integer; in other words, it is the product of some integer with itself.

Examples

InputOutputExplanation
16True16 is a perfect square because 4 * 4 = 16.
14False14 is not a perfect square because there is no integer whose square is equal to 14.
9True9 is a perfect square because 3 * 3 = 9.

Constraints:

  • 1 <= n <= 10<sup>4</sup>

Try it yourself

Try solving this question here:

Python3
Python3

. . . .

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible