# leet
[Leet] - 20. Valid Parentheses [stack] - c++
https://leetcode.com/problems/valid-parentheses/C++ stack(괄호)
[Leet] - 454. 4Sum II[hash] - c++
https://leetcode.com/problems/4sum-ii/c++ unordered_map 풀이시간제한 해결 위해 nums1,nums2 / nums3,nums4 각각으로 O(n^2)시간 복잡도1\. 처음 두 배열에 대해 unordered_map에 &
[Leet] - 258. Add Digits [simulation] - c++
https://leetcode.com/problems/add-digits/C++ char<->int 변환 풀이char->int 바꾸는 방법 : (char)c-'0'더 빠른 풀이 (목과 나머지 관계 이용)
[Leet] - 80. Remove Duplicates from Sorted Array II [Two pointers, Sliding Window] - c++
https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/C++ 투포인터 풀이slow, fast 투 포인터 설정 (초기값 : 2 ->문제 조건 at most twice)slow = 새롭게 저장될
[Leet] - 389. Find the Difference [Hash table] - c++
https://leetcode.com/problems/find-the-difference/C++ 알파벳 배열로 풀이법빠른 풀이(아스키코드의 합 비교 후 차이로 구하는 법)
[Leet] - 121. Best Time to Buy and Sell Stock [dp] - c++
https://leetcode.com/problems/best-time-to-buy-and-sell-stock/dp풀이1.int vi = i일 까지 최대 profit 저장 배열 2.index= 0(시작) 지점에서는 buy배열에 값 저장3.prices배열 마지막
[Leet] - 189. Rotate Array [원형] - c++
https://leetcode.com/problems/rotate-array/remainder(%) 사용 2.수학적 계산 풀이
[Leet] - 1672. Richest Customer Wealth [배열] - c++
https://leetcode.com/problems/richest-customer-wealth/C++풀이
[Leet] - 1305. All Elements in Two Binary Search Trees
https://leetcode.com/problems/all-elements-in-two-binary-search-trees/DFS 실행 결과 1,3,4,5,6,7,8 순으로 저장 C++풀이시간 개선 => merge사용
[LeetCode] 435. Non-overlapping Intervals - 그리디 c++
그리디 풀이 1.시작시간 기준 오름차순으로 정렬 2.현재 구간 시작시간이 이전 구간 끝 시간 이상인 경우 : 현재 구간 끝 시간으로 업데이트 겹치는 경우 : ans++ / 겹치는 두 구간 중 끝나는 시간이 느린 구간 삭제 => 현재 정렬된 상태에서 끝나는 시간 느릴수록
[LeetCode] 15. 3Sum - c++
선택된 세 수가 서로 다른 경우일 때만 포함\-세 수의 합 == target값 인 경우에도 왼쪽(lo)값 ++를 기본값으로 설정\-중복 제거 : if(i>0 && numsi==numsi-1) continue / while(lo<hi && numslo==nums
[LeetCode] 986. Interval List Intersections - c++
투포인터 풀이List A와 B 각각 포인터를 두고 각각 시작과 끝을 비교