Guest User

Untitled

a guest
Oct 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.14 KB | None | 0 0
  1. class PowerOfTwo {
  2. func isPowerOfTwo(_ n: Int) -> Bool {
  3. return n == 1 ? true : ( n<1 || n%2 != 0) ? false : isPowerOfTwo(n/2)
  4. }
  5. }
Add Comment
Please, Sign In to add comment