ARTS #56 Algorithm 本周选择的算法题是:字符串的排列 规则如下: 输入一个字符串,打印出该字符串中字符的所有排列。 你可以以任意顺序返回这个字符串数组,但里面不能有重复元素。 示例: 输入:s = "abc" 输出:["abc","acb","bac","bca","cab","cba"] 限制: 1 <= s 的长度 <= 8 Solution Runt... 2020-06-272 min read
ARTS #55 Algorithm 本周选择的算法题是:Construct Binary Tree from Preorder and Inorder Traversal 规则如下: Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicat... 2020-06-202 min read
ARTS #54 Algorithm 本周选择的算法题是:Climbing Stairs 规则如下: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cli... 2020-06-133 min read
ARTS #53 Algorithm 本周选择的算法题是:Best Time to Buy and Sell Stock II 规则如下: Say you have an array prices for which the ith element is the price of a given stock on day i. Design an algorithm to find the maxim... 2020-06-063 min read
ARTS #52 Algorithm 本周选择的算法题是:Search a 2D Matrix II 规则如下: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are ... 2020-05-304 min read
ARTS #51 Algorithm 本周选择的算法题是:Maximum Number of Occurrences of a Substring 规则如下: Given a string s, return the maximum number of ocurrences of any substring under the following rules: The number of uni... 2020-05-235 min read
ARTS #50 Algorithm 本周选择的算法题是:Word Search II 规则如下: Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adjace... 2020-05-167 min read
ARTS #49 Algorithm 本周选择的算法题是:Video Stitching 规则如下: You are given a series of video clips from a sporting event that lasted T seconds. These video clips can be overlapping with each other and have varied ... 2020-05-096 min read
ARTS #48 Algorithm 本周选择的算法题是:Letter Combinations of a Phone Number 规则如下: Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A m... 2020-05-023 min read
ARTS #47 Algorithm 本周选择的算法题是:N-Queens 规则如下: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distin... 2020-04-256 min read