給定一個可包含重復(fù)數(shù)字的序列,返回所有不重復(fù)的全排列。 示例: 輸入: [1,1,2]輸出:[[1,1,2],[1,2,1],[2,1,1]] 解題思路 在全排列的基礎(chǔ)上去重...
給定一個可包含重復(fù)數(shù)字的序列,返回所有不重復(fù)的全排列。 示例: 輸入: [1,1,2]輸出:[[1,1,2],[1,2,1],[2,1,1]] 解題思路 在全排列的基礎(chǔ)上去重...
給定一個沒有重復(fù)數(shù)字的序列,返回其所有可能的全排列。 示例: 輸入: [1,2,3]輸出:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[...
將一個給定字符串根據(jù)給定的行數(shù),以從上往下、從左到右進行 Z 字形排列。 比如輸入字符串為 "LEETCODEISHIRING" 行數(shù)為 3 時,排列如下: L C ...
給定一個字符串 s,找到 s 中最長的回文子串。你可以假設(shè) s 的最大長度為 1000。 示例 1: 輸入: "babad"輸出: "bab"注意: "aba" 也是一個有效...
給定一個字符串,請你找出其中不含有重復(fù)字符的 最長子串 的長度。 示例 1: 輸入: "abcabcbb"輸出: 3解釋: 因為無重復(fù)字符的最長子串是 "abc",所以其長度...
給出兩個 非空 的鏈表用來表示兩個非負(fù)的整數(shù)。其中,它們各自的位數(shù)是按照 逆序 的方式存儲的,并且它們的每個節(jié)點只能存儲 一位 數(shù)字。 如果,我們將這兩個數(shù)相加起來,則會返回...
給定一個整數(shù)數(shù)組 nums 和一個目標(biāo)值 target,請你在該數(shù)組中找出和為目標(biāo)值的那 兩個 整數(shù),并返回他們的數(shù)組下標(biāo)。 你可以假設(shè)每種輸入只會對應(yīng)一個答案。但是,你不能...
We are given a linked list with head as the first node. Let's number the nodes in the ...
Given an array A of 0s and 1s, consider N_i: the i-th subarray from A[0] to A[i] interp...
Given a positive integer K, you need find the smallest positive integer N such that N i...
Given an array A of positive integers, A[i] represents the value of the i-th sightseein...
Given a number N, return a string consisting of "0"s and "1"s that represents its value...
Given an array A of integers, return true if and only if we can partition the array int...
A conveyor belt has packages that must be shipped from one port to another within D day...
In a list of songs, the i-th song has a duration of time[i] seconds. Return the number ...
Every non-negative integer N has a binary representation. For example, 5 can be repres...
Return the root node of a binary search tree that matches the given preorder traversal....
In a row of dominoes, A[i] and B[i] represent the top and bottom halves of the i-th dom...
Normally, the factorial of a positive integer n is the product of all positive integers...