← Back to challenges

Next Perfect Square

PythonHardalgebramathnumbersinterview

Instructions

Mubashir needs your help to find next integral perfect square after the one passed as a parameter.

Create a function which takes a given number n and returns next integral perfect square number. Return None if the given number is not a perfect square.

Examples

next_square(121) ➞ 144

next_square(625) ➞ 676

next_square(114) ➞ None
# 114 is not a perfect square

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Find Unique Character Strings