목록투포인터 (4)
N
https://leetcode.com/problems/maximum-erasure-value/ Maximum Erasure Value - 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 Set과 Two pointer를 활용한 문제 풀이. sliding window 구조 형태로 동작. for문으로 nums를 순회한다. 순회할 시 left, right 변수를 이용한다. 두 변수는 sliding window의 범위를 조절하는 역할을 한다. 만약 obj에서 nums[ri..
https://leetcode.com/problems/di-string-match/ DI String Match - 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 투포인터 알고리즘 적용. 답을 리턴할 배열 answer을 선언. front와 back을 이용해 답을 찾을 것이다. front = 0, back = s.length으로 선언한 후 for문 진행. 만약 현재 문자가 "I"라면 front++를 answer에 push. 그렇지 않고 "D"라면 back--를 a..

11. Container With Most Water Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a container, such that the container contains the most water. Notice that you may not slant the container. Example 1: ..

11. Container With Most Water Medium 10383742Add to ListShare Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a container, such that the container contains the most water. Notice that you may not ..