📝
Power of Two
Power of Two입문 기초 문법 +5pts
Problem
Write a function that returns 2 raised to the given power.
Examples
Input:
powerOfTwo(3)Output:
8Input:
powerOfTwo(0)Output:
1Explanation
이 문제는 **거듭제곱 연산**을 학습합니다. 컴퓨터 과학에서 2의 거듭제곱은 특별히 중요합니다. **Math.pow() 함수** `Math.pow(base, exponent)`는 base의 exponent 거듭제곱을 반환합니다: - Math.pow(2, 3) = 2³ = 8 - Math.pow(2, 0) = 2⁰ = 1 **거듭제곱 연산자 (**)** ES2016부터 `**` 연산자를 사용할 수 있습니다: - `2 ** 3` = 8 - `2 ** 10` = 1024 **2의 거듭제곱이 중요한 이유** 컴퓨터는 2진법을 사용하...
View detailed explanation →Key Concepts
Math.pow 함수 거듭제곱 연산자 (**) 2의 거듭제곱 0제곱의 정의
Time: O(1) Space: O(1)
solution.js
Ctrl + Enter
Run tests to see results here.