Skip to content

Latest commit

 

History

History
11 lines (9 loc) · 174 Bytes

8 kyu - Find Nearest square number.md

File metadata and controls

11 lines (9 loc) · 174 Bytes

Task

Your task is to find the nearest square number, nearest_sq(n), of a positive integer n.

Goodluck :)

Solution

def nearest_sq(n)
  (n**0.5).round**2
end