[Leetcode/파이썬] 56. Merge Intervals
Merge IntervalsGiven an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input. Example 1:Input: intervals = [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Explanation: Since intervals [1,3] and [2,6] overlap, merge them into [1,6].Example 2:Input: intervals..
더보기
[Leetcode/파이썬] 49. Group Anagrams
Group AnagramsGiven an array of strings strs, group the anagrams together. You can return the answer in any order. Example 1:Input: strs = ["eat","tea","tan","ate","nat","bat"]Output: [["bat"],["nat","tan"],["ate","eat","tea"]]Explanation:There is no string in strs that can be rearranged to form "bat".The strings "nat" and "tan" are anagrams as they can be rearranged to form each other.The strin..
더보기
[Leetcode/파이썬] 53. Maximum Subarray
Maximum SubarrayGiven an integer array nums, find the subarray with the largest sum, and return its sum. Example 1:Input: nums = [-2,1,-3,4,-1,2,1,-5,4]Output: 6Explanation: The subarray [4,-1,2,1] has the largest sum 6.Example 2:Input: nums = [1]Output: 1Explanation: The subarray [1] has the largest sum 1.Example 3:Input: nums = [5,4,-1,7,8]Output: 23Explanation: The subarray [5,4,-1,7,8] has t..
더보기