twopointers

You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).Find two lines that together with the x-axis form a container, such that the container contains the most water.Return the maximum amound of water a container can store.Notice that you may not slant the container.그림을 보면 μ‰½κ²Œ 이해가 κ°€λŠ₯ν•˜λ‹€. slant (κΈ°..
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.Notice that the solution set must not contain duplicate triplets. ν’€μ΄ 1: 브루트 포슀 - μ‹œκ°„ 초과class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: res = set() nums.sort() for i in range(len(nums)): ..
Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2] where 1 Return the indices of the two numbers, index1 and index2, added by one as an integer array [index1, index2] of length 2.The tests are generated such that there is exactl..
A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.Given a string s, return true if it is a palindrome, or false otherwise.μœ νš¨ν•œ palindrome(회문) κ²€μ‚¬ν•˜λŠ” λ©”μ„œλ“œ κ΅¬ν˜„ν•˜κΈ°! ν’€μ΄1: Reverse Stringclass Solution: def isPalindrome(self, s:..
yesolz
'twopointers' νƒœκ·Έμ˜ κΈ€ λͺ©λ‘