Algorithm
-
[Leetcode] 485. Max Consecutive Ones 문제 해결Algorithm/문제풀이 2021. 9. 21. 17:34
https://leetcode.com/problems/max-consecutive-ones/ Max Consecutive Ones - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 연속된 1의 갯수의 길이가 가장 큰 길이 구하기 Example 1: Input: nums = [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three digits are consecutive 1s..
-
[Leetcode] 438. Find All Anagrams in a String 문제 풀이Algorithm/문제풀이 2021. 9. 19. 21:58
https://leetcode.com/problems/find-all-anagrams-in-a-string/ Find All Anagrams in a String - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 anagram이라는 문자열을 찾고 시작하는 index를 출력하는 문제 anagram은 순서 상관없이 문자수가 같은 문자열을 의미한다. Example 1: Input: s = "cbaebabacd", p = "abc" Output: [0,6] ..
-
[Leetcode] 11. Container With Most Water 문제 풀이Algorithm/문제풀이 2021. 9. 19. 21:07
https://leetcode.com/problems/container-with-most-water/ Container With Most Water - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 댐 높이가 주어졌을 때 2개의 댐 사이에 있는 물의 양이 가장 큰 값을 구하는 문제 Example 1: Input: height = [1,8,6,2,5,4,8,3,7] Output: 49 Explanation: The above vertical lines ..
-
[Leetcode] 115. Distinct Subsequences 문제 풀이Algorithm/문제풀이 2021. 9. 19. 20:50
https://leetcode.com/problems/distinct-subsequences/ Distinct Subsequences - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 문자열s에서 문자를 지웠을 때 문자열t 가 나타날 수 있도록 하는 경우의 수 Example 1: Input: s = "rabbbit", t = "rabbit" Output: 3 Explanation: As shown below, there are 3 ways you ca..
-
[Leetcode] 986. Interval List Intersections 문제풀이Algorithm/문제풀이 2021. 9. 18. 16:23
https://leetcode.com/problems/interval-list-intersections/ Interval List Intersections - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 2개의 스케줄 리스트가 있는데 겹치는 부분 출력하기 Example 1: Input: firstList = [[0,2],[5,10],[13,23],[24,25]], secondList = [[1,5],[8,12],[15,24],[25,26]] Outp..
-
[Leetcode] 844. Backspace String Compare 문제풀이Algorithm/문제풀이 2021. 9. 18. 15:45
https://leetcode.com/problems/backspace-string-compare/ Backspace String Compare - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 문자열 2개에 backspace(문자 1개 지우는 키)가 포함된 문자열로 주어진다. 문자열 2개의 최종 결과값이 같은지 비교하는 문제 Example 1: Input: s = "ab#c", t = "ad#c" Output: true Explanation: Bot..
-
[Leetcode] 15. 3Sum 문제풀이Algorithm/문제풀이 2021. 9. 18. 13:27
https://leetcode.com/problems/3sum/ 3Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 배열에서 서로 다른 값 3개로 0을 만드는 원소들의 집합구하기 Example 1: Input: nums = [-1,0,1,2,-1,-4] Output: [[-1,-1,2],[-1,0,1]] 문제 풀이 변수 1개를 고정하면 2sum문제로 풀 수 있다. hash를 이용해서 값이 주어지면 값에 맞는 index를 바로 가져올 수 있도록 ..
-
[Leetcode] 82. Remove Duplicates from Sorted List II 문제 풀이Algorithm/문제풀이 2021. 9. 17. 21:34
https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/ Remove Duplicates from Sorted List II - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 정렬된 리스트에서 중복된 요소 다 제거하는 문제 Input: head = [1,2,3,3,4,4,5] Output: [1,2,5] 문제 풀이 같은 수의 end 노드를 찾고 next랑 prev랑 연결하는 방식으로 풀..