mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-03 19:52:01 +08:00
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
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* File: fast_power.java
|
||||
* Created Time: 2026-08-18
|
||||
* Author: Hello Algo Team
|
||||
*/
|
||||
|
||||
package chapter_divide_and_conquer;
|
||||
|
||||
public class fast_power {
|
||||
/* 빠른 거듭제곱 */
|
||||
static int fastPow(int x, int n) {
|
||||
if (n == 0) {
|
||||
return 1;
|
||||
}
|
||||
int half = fastPow(x, n / 2);
|
||||
if (n % 2 == 0) {
|
||||
return half * half;
|
||||
}
|
||||
return half * half * x;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
assert fastPow(7, 0) == 1;
|
||||
assert fastPow(3, 5) == 243;
|
||||
assert fastPow(2, 6) == 64;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user