Shilei Tian

Waiting Persistent Accumulation Surpass

[Leetcode 331] Verify Preorder Serialization of a Binary Tree

题目要求One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node’s value. If it is a null..


[Leetcode 96] Unique Binary Search Trees

题目要求Given n, how many structurally unique BST’s (binary search trees) that store values 1…n? For example,Given n = 3, there are a total of 5 unique ..


[Leetcode 516] Longest Palindromic Subsequence

题目要求Given a string s, find the longest palindromic subsequence’s length in s. You may assume that the maximum length of s is 1000. Example 1:Input: ..


[Leetcode 494] Target Sum

题目要求You are given a list of non-negative integers, a1, a2, …, an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choo..


[Leetcode 486] Predict the Winner

题目要求Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2..


[Leetcode 496] Next Greater Element I

题目要求You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for ..


[Leetcode 398] Random Pick Index

题目要求Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target nu..


[Leetcode 201] Bitwise AND of Numbers Range

题目要求Given a range [m, n] where $0 \leq m \leq n \leq 2147483647$, return the bitwise AND of all numbers in this range, inclusive. For example, given..