ARTS #40 Algorithm 本周选择的算法题是:Subsets II 规则如下: Given a collection of integers that might contain duplicates, *nums*, return all possible subsets (the power set). Note: The solution set must not contain d...
ARTS #39 Algorithm 本周选择的算法题是:Rotate Image 规则如下: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in-place, which m...
ARTS #38 Algorithm 本周选择的算法题是:Integer to Roman 规则如下: Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10...
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...