原创 LeetCode 667. Beautiful Arrangement II

Given two integers n and k, you need to construct a list which contains n different positive integers ranging fro

原创 LeetCode:442. Find All Duplicates in an Array

Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. F

原创 Leetcode 32. Longest Valid Parentheses

問題描述 Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed)

原创 Leetcode 174. Dungeon Game

問題描述 table.dungeon, .dungeon th, .dungeon td { border:3px solid black; } .dungeon th, .dungeon td { text-

原创 Leetcode 97. Interleaving String

問題描述 Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aa

原创 Leetcode 87. Scramble String

問題描述 Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recur

原创 LeetCode: Add to List 414. Third Maximum Number

Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return t

原创 Leetcode 188. Best Time to Buy and Sell Stock IV

問題描述 Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm t

原创 LeetCode:204. Count Primes

Description: Count the number of prime numbers less than a non-negative number, n. Credits:Special thanks to @mith

原创 Leetcode:621. Task Scheduler

Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters r

原创 Leetcode 115. Distinct Subsequences

問題描述 Given a string S and a string T, count the number of distinct subsequences of S which equals T. A subseque

原创 Leetcode:611. Valid Triangle Number

Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the ar

原创 665. Non-decreasing Array

Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 el

原创 LeetCode: 479. Largest Palindrome Product

Find the largest palindrome made from the product of two n-digit numbers. Since the result could be very large, y

原创 LeetCode: 581. Shortest Unsorted Continuous Subarray

Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending