Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
26 changes: 26 additions & 0 deletions climbing-stairs/YuuuuuuYu.java
Original file line number Diff line number Diff line change
@@ -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<dp.length; i++) {
dp[i] = dp[i-1] + dp[i-2];
}

return dp[n];
}
}
33 changes: 33 additions & 0 deletions valid-anagram/YuuuuuuYu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Runtime: 2ms
* Time Complexity: O(n)
*
* Memory: 44.56MB
* Space Complexity: O(1)
*
* Approach: a~z 알파벳 개수 배열을 사용하여 짝을 이루는지 검사
* - 알파벳 개수가 똑같다면 +- 했을 때 0이 됨
*/
class Solution {
public boolean isAnagram(String s, String t) {
if (s.length() != t.length()) return false;

int[] checkedArr = new int[26];
for (char element: s.toCharArray()) {
int index = (int)element - 'a';
checkedArr[index]++;
}

for (char element: t.toCharArray()) {
int index = (int)element - 'a';
checkedArr[index]--;
}

for (int alphabet: checkedArr) {
if (alphabet != 0)
return false;
}

return true;
}
}