给定一个可包含重复数字的序列,返回所有不重复的全排列。 示例: 输入: [1,1,2]输出:[[1,1,2],[1,2,1],[2,1,1]] 解题思路 在全排列的基础上去重...
给定一个可包含重复数字的序列,返回所有不重复的全排列。 示例: 输入: [1,1,2]输出:[[1,1,2],[1,2,1],[2,1,1]] 解题思路 在全排列的基础上去重...
给定一个没有重复数字的序列,返回其所有可能的全排列。 示例: 输入: [1,2,3]输出:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[...
将一个给定字符串根据给定的行数,以从上往下、从左到右进行 Z 字形排列。 比如输入字符串为 "LEETCODEISHIRING" 行数为 3 时,排列如下: L C ...
给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 示例 1: 输入: "babad"输出: "bab"注意: "aba" 也是一个有效...
给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。 示例 1: 输入: "abcabcbb"输出: 3解释: 因为无重复字符的最长子串是 "abc",所以其长度...
给出两个 非空 的链表用来表示两个非负的整数。其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字。 如果,我们将这两个数相加起来,则会返回...
给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能...
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...