ARTS #37 Algorithm 本周选择的算法题是:Pascal’s Triangle II 规则如下: Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal’s triangle. Note that the row index starts from 0. In Pascal’s...
ARTS #36 Algorithm 本周选择的算法题是:Trapping Rain Water 规则如下: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after rainin...
ARTS #35 Algorithm 本周选择的算法题是:First Missing Positive 规则如下: Given an unsorted integer array, find the smallest missing positive integer. Example 1: Input: [1,2,0] Output: 3 Example 2: Input: [3,4,-1,1...
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...