diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index a7cff26145..440ed01a52 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -2,12 +2,10 @@ name: Integration πŸ”„ on: pull_request: - merge_group: jobs: linelint: runs-on: ubuntu-latest - if: github.event_name == 'pull_request' steps: - uses: actions/checkout@v4 with: diff --git a/climbing-stairs/YuuuuuuYu.java b/climbing-stairs/YuuuuuuYu.java new file mode 100644 index 0000000000..0185327867 --- /dev/null +++ b/climbing-stairs/YuuuuuuYu.java @@ -0,0 +1,26 @@ +/** + * Runtime: 0ms + * Time Complexity: O(n) + * + * Memory: 42.18MB + * Space Complexity: O(n) + * + * Approach: DPλ₯Ό μ΄μš©ν•œ 점화식 ν™œμš© + * - n번째 계단에 λ„λ‹¬ν•˜λŠ” 방법은 (n-1)번째 κ³„λ‹¨μ—μ„œ ν•œ μΉΈ μ˜¬λΌμ˜€λŠ” 방법과 + * (n-2)번째 κ³„λ‹¨μ—μ„œ 두 μΉΈ μ˜¬λΌμ˜€λŠ” λ°©λ²•μ˜ ν•©κ³Ό κ°™μŒ + */ +class Solution { + public int climbStairs(int n) { + if (n == 1) return 1; + else if (n == 2) return 2; + + int[] dp = new int[n+1]; + dp[1] = 1; + dp[2] = 2; + for (int i=3; i