Search
Duplicate
๐Ÿ“—

power of two

์ฃผ์ฐจ
๋ฌธ์ œ๋ฒˆํ˜ธ
231
์–ธ์–ด
Swift
ํ‹ฐ์–ด
Easy
์œ ํ˜•
์ˆ˜ํ•™
nj_Blog
nj_์ƒํƒœ
์ดํ•ด๋„
100%
ํ’€์ด
์‚ฌ๋žŒ
์ดํ•ด๋„ 2
13 more properties

๋ฌธ์ œ์ ‘๊ทผ

๋†“์ณค๋˜ ๋ถ€๋ถ„

์ฝ”๋“œ

13.5 MB

0 ms

class Solution { func isPowerOfTwo(_ n: Int) -> Bool { var temp = 1 while (temp < n) { temp *= 2 } return temp == n //n์ „๊นŒ์ง€ temp์— 2๋ฅผ ๊ณฑํ•˜๊ณ  true ํ˜น์€ false ๋ฐ˜ํ™˜ } }
C++
๋ณต์‚ฌ