原创 LeetCode-Best Time to Buy and Sell Stock IV(JAVA)

Say you have an array for which the i-th element is the price of a given stock on day i. Design an algorithm to fin

原创 LeetCode-combination-sum (JAVA)

Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique c

原创 LeetCode-Longest Palindromic Substring(JAVA)

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000

原创 LeetCode- Find First and Last Position of Element in Sorted Array (JAVA)

Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target

原创 LeetCode-Unique Binary Search Trees(JAVA)

Given n, how many structurally unique BST’s (binary search trees) that store values 1 … n? Example: Input: 3 Outpu

原创 Leetcode-Regular Expression Matching(C++)

Implement regular expression matching with support for ‘.’ and ‘*’. ‘.’ Matches any single character. ‘*’ Matches z

原创 LeetCode-Distinct Subsequences(JAVA)

Given a string S and a string T, count the number of distinct subsequences of S which equals T. A subsequence of a

原创 LeetCode-Interleaving String(JAVA)

Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. Example 1: Input: s1 = “aabcc”, s2 =

原创 LeetCode-Majority Element II (JAVA)

Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. Note: The algorithm shoul

原创 LeetCode-Maximal Rectangle(JAVa)

Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1’s and return its are

原创 LEET CODE-Next Permutation(JAVA)

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of number

原创 LeetCode- Longest Valid Parentheses(JAVA)

Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) paren

原创 LeetCod-Search in Rotated Sorted Array (Java)

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6

原创 LeetCode-Wildcard Matching (JAVA)

Given an input string (s) and a pattern §, implement wildcard pattern matching with support for ‘?’ and ‘*’. ‘?’ Ma

原创 LeetCode-Scramble String(JAVA)

Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.