Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

1 of 3
mathmandan
  • 1k
  • 11
  • 10

Python 3, 40 bytes

lambda n:any(i*i==n for i in range(n+1))

Try it online!

Too slow to return an answer for 2147483647 in a reasonable amount of time, but would work given sufficient time.

(This works in Python 2 also, but note that Python 2 will yield an OverflowError on very large inputs, due to range.)

mathmandan
  • 1k
  • 11
  • 10

AltStyle によって変換されたページ (->オリジナル) /