ARTS #27 Algorithm 本周选择的算法题是:Search in Rotated Sorted Array 规则如下: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,... 2019-12-074 min read
ARTS #26 Algorithm 本周选择的算法题是:Next Permutation 规则如下: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib... 2019-11-303 min read
ARTS #25 Algorithm 本周选择的算法题是:Remove Element 规则如下: Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another arra... 2019-11-234 min read
ARTS #24 Algorithm 本周选择的算法题是:4Sum 规则如下: Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in... 2019-11-165 min read
ARTS #23 Algorithm 本周选择的算法题是:Search Insert Position 规则如下: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted ... 2019-11-097 min read
ARTS #22 Algorithm 本周选择的算法题是:Longest Valid Parentheses 规则如下: Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Example ... 2019-11-025 min read
ARTS #21 Algorithm 本周选择的算法题是:Remove Duplicates From Sorted Array 规则如下: Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not... 2019-10-266 min read
ARTS #20 Algorithm 本周选择的算法题是:3Sum Closest 规则如下: Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three in... 2019-10-194 min read
ARTS #19 Algorithm 本周选择的算法题是: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 tw... 2019-10-126 min read
ARTS #18 Algorithm 本周选择的算法题是:Subarrays with K Different Integers 规则如下: Given an array A of positive integers, call a (contiguous, not necessarily distinct) subarray of A good if the number of different i... 2019-10-055 min read