Notice
Recent Posts
Recent Comments
Link
목록POW (1)
허허의 오늘은 뭐 먹지?
[leetcode] 50. Pow(x, n)
x^n 결과를 구하는 문제입니다. leetcode.com/problems/powx-n/ Pow(x, n) - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 이 문제는 x를 n번 루프를 돌려서 풀면.. 타임아웃이 나버립니다. 2^10이라고 10번 2를 곱해줄것이 아니라 2^10 = 2^4 * 2^4 * 2^2 2^4 = 2^2 * 2^2 2^2 해서 총 세번의 연산으로 최종 값을 구할 수 있습니다. 아래 코드는.. i를 n부터 시작해서 i를 반씩 나눠주며 계산합니..
SW/알고리즘
2021. 3. 4. 00:31