Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Fi…
标签:LeetCode题目解答
[LeetCode] Max Consecutive Ones 最大连续1的个数
Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0…
leetCode | Next Permutation
题目: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation o…
220. Contains Duplicate III
Given an array of integers, find out whether there are two distinct indices i and j in the array such that the…
40. Combination Sum II
40. Combination Sum II 题目 Given a collection of candidate numbers (C) and a target number (T), find all unique…
[LeetCode] Same Tree 判断相同树
Given two binary trees, write a function to check if they are equal or not. Two binary trees are consid…
[LeetCode] Flip Game 翻转游戏
You are playing the following Flip Game with your friend: Given a string that contains only these two c…
[LeetCode] Delete Node in a BST 删除二叉搜索树中的节点
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return t…
[Leetcode] Reverse Integer 反转整数
Reverse Integer Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 字符串…
[LeetCode] Smallest Rotation with Highest Score 得到最高分的最小旋转
Given an array A, we may rotate it by a non-negative integer K so that the array becomes…
264. Ugly Number II
Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only inclu…
[LeetCode] Longest Substring with At Most Two Distinct Characters 最多有两个不同字符的最长子串
Given a string S, find the length of the longest substring T that contains at most two distinct charact…