문제 https://leetcode.com/problems/two-sum/ 풀이 먼저 O(N^2)인 브루트포스로 제출한 풀이는 다음과 같다. 이후 시간복잡도는 O(N)으로 해시테이블을 이용하여 제출한 풀이는 다음과 같다.
문제 https://leetcode.com/problems/group-anagrams/description/?envType=study-plan-v2&envId=top-100-liked 풀이 순서를 바꿨을 때 모두 동일하다는 것을 체크하기 위해 정렬을 이용했다. 또한,
문제 https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/?envType=study-plan-v2&envId=top-100-liked 풀이 sell위치가 buy위치 이후에 와야한다는 점을
문제 https://leetcode.com/problems/jump-game/description/?envType=study-plan-v2&envId=top-100-liked 풀이 최대 도달 가능한 인덱스의 위치를 계속해서 갱신시켜 나가서 정답을 찾았습니다.
문제 https://leetcode.com/problems/partition-labels/description/?envType=study-plan-v2&envId=top-100-liked 풀이 two pointer를 이용해서 last index를 갱신하며 푼 풀이는
https://leetcode.com/problems/climbing-stairs/description/?envType=study-plan-v2&envId=top-100-likedtop down 풀이와 bottom up풀이가 모두 가능하고, 메모이제이션을 통해
https://leetcode.com/problems/single-number/description/?envType=study-plan-v2&envId=top-100-likedconstant extra space만을 이용하도록 하는 방법이 도저히 떠오르지 않았
https://leetcode.com/problems/subarray-sum-equals-k/?envType=study-plan-v2&envId=top-100-liked이 문제는 브루트포스로 접근하면 O(N^3)이 된다.따라서 최적화를 위해 i~j구간의 합의
문제 https://leetcode.com/problems/longest-consecutive-sequence/ 풀이 혼자힘으로 풀지 못했고, discussion의 답을 확인하였다. 핵심은 set() 형변환을 통해 특정 숫자가 존재하는지 체크하는 in 연산을 할 때
https://leetcode.com/problems/majority-element/?envType=study-plan-v2&envId=top-100-liked시간복잡도 O(N)으로 풀리도록 처음 제출한 풀이는 다음과 같다.정렬을 이용할 수 있으나 그러면 시간
https://leetcode.com/problems/jump-game-ii/description/?envType=study-plan-v2&envId=top-100-likedDP를 이용해서 처음에 제출한 풀이는 다음과 같다. 시간복잡도는 O(N^2)으로 AC를
https://leetcode.com/problems/pascals-triangle/description/?envType=study-plan-v2&envId=top-100-liked이전 레벨의 수들을 통해 다음 레벨의 수를 구하면 되었다.(DP)
https://leetcode.com/problems/valid-parentheses/description/?envType=study-plan-v2&envId=top-100-liked자주 접했던 문제이고, 스택을 이용해서 푼 첫 풀이는 다음과 같다.
https://leetcode.com/problems/daily-temperatures/description/?envType=study-plan-v2&envId=top-100-likedN이 최대 10^5이므로 브루트포스로 접근했을 때인 O(N^2)으로는 Tim
https://leetcode.com/problems/min-stack/description/?envType=study-plan-v2&envId=top-100-likedgetMin을 O(1)로 구현하게 하는것이 핵심이다.만약 getMin을 O(1)이 아닌 O(
https://leetcode.com/problems/decode-string/description/?envType=study-plan-v2&envId=top-100-liked혼자 힘으로 해결하지 못해 discussion을 보고 풀이를 이해하기 위해 노력했다.
https://leetcode.com/problems/house-robber/description/?envType=study-plan-v2&envId=top-100-likeddpk를 "k번째 house까지의 최대 rob 합" 으로 정의하고, 식을 세워 값을 채