recursion1 [HackkerRank] Recursion: Davis' Staircase 1. Link to the problem https://www.hackerrank.com/challenges/ctci-recursive-staircase/problem 2. Feedback [부분집합 문제] 재귀 사용 brute-force 로 푼다면, 재귀이기 때문에 n * n-1 * n-2 … 1 로 O(n의 제곱) 이 중 중복된 작업을 제거하고자 캐시 사용 3. Source public class RecursionDavisStaircase { private static int cache[]; public static void main(String [] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int testcase.. 2018. 6. 26. 이전 1 다음