memoization

    [LeetCode] - happy number

    Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits. Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy. R..

    [LeetCode] Fibonacci number with Dynamic Programming

    요약 재귀함수를 사용해서 풀면 비효율적인 호출이 많아진다. -> 다이나믹 프로그래밍을 활용하자. 재귀함수로 해결할 시 시간복잡도 O(2^n) 다이나믹 프로그래밍으로 해결시 시간 복잡도 O(N) 멘토님의 키워드 왜 n은 30까지로 해놨을까? 30이 넘으면 어떻게 되는지 돌려보기. -> overflow?! n이 30, 50, 100, 500일때 구해보기. 구글에 int32 range, unsigned int32 range 등으로 검색하면 Type Name Bytes Range of Values __int32 4 -2,147,483,648 to 2,147,483,647 unsigned __int32 4 0 to 4,294,967,295 __int64 8 -9,223,372,036,854,775,808 to 9..