Files
Yudong Jin 2f561d3d51 feat(ko): add the Korean online edition (#2006)
* feat(ko): add the complete Korean online edition

* Use UTF-8 for Python CI output on Windows

* Remove print-book promotion from the Korean site

* fix(ko): preserve emphasis before Korean particles
2026-10-29 03:46:43 +08:00

22 lines
462 B
JavaScript

/**
* File: fast_power.js
* Created Time: 2026-08-18
* Author: Hello Algo Team
*/
/* 빠른 거듭제곱 */
function fastPow(x, n) {
if (n === 0) {
return 1;
}
const half = fastPow(x, Math.floor(n / 2));
if (n % 2 === 0) {
return half * half;
}
return half * half * x;
}
if (fastPow(7, 0) !== 1 || fastPow(3, 5) !== 243 || fastPow(2, 6) !== 64) {
throw new Error('빠른 거듭제곱 검증에 실패했다');
}