ARTS #34 Algorithm 本周选择的算法题是:Rotate Array 规则如下: Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Ex...
ARTS #33 Algorithm 本周选择的算法题是:Valid Parentheses 规则如下: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: ...
ARTS #32 Algorithm 本周选择的算法题是:Combination Sum II 规则如下: Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate num...
ARTS #31 Algorithm 本周选择的算法题是:Pascal’s Triangle 规则如下: Given a non-negative integer numRows, generate the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbe...
ARTS #30 Algorithm 本周选择的算法题是:Combination Sum 规则如下: Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the ca...
ARTS #29 Algorithm 本周选择的算法题是:Plus One 规则如下: Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the most significant digit is ...
ARTS #28 Algorithm 本周选择的算法题是:Find First and Last Position of Element in Sorted Array 规则如下: Given an array of integers nums sorted in ascending order, find the starting and ending position of a given targ...
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,...
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...
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...