随笔分类 - LeetCode
摘要:Remove Palindromic Subsequences (E) 题目 Given a string s consisting only of letters 'a' and 'b'. In a single step you can remove one palindromic subseq
阅读全文
摘要:Design HashMap (E) 题目 Design a HashMap without using any built-in hash table libraries. To be specific, your design should include these functions: pu
阅读全文
摘要:Short Encoding of Words (M) 题目 A valid encoding of an array of words is any reference string s and array of indices indices such that: words.length ==
阅读全文
摘要:Average of Levels in Binary Tree (E) 题目 Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Ex
阅读全文
摘要:Intersection of Two Linked Lists (E) 题目 Write a program to find the node at which the intersection of two singly linked lists begins. For example, the
阅读全文
摘要:Set Mismatch (E) 题目 You have a set of integers s, which originally contains all the numbers from 1 to n. Unfortunately, due to some error, one of the
阅读全文
摘要:Distribute Candies (E) 题目 Alice has n candies, where the ith candy is of type candyType[i]. Alice noticed that she started to gain weight, so she visi
阅读全文
摘要:Maximum Frequency Stack (H) 题目 Implement FreqStack, a class which simulates the operation of a stack-like data structure. FreqStack has two functions:
阅读全文
摘要:Validate Stack Sequences (M) 题目 Given two sequences pushed and popped with distinct values, return true if and only if this could have been the result
阅读全文
摘要:Shortest Unsorted Continuous Subarray (M) 题目 Given an integer array nums, you need to find one continuous subarray that if you only sort this subarray
阅读全文
摘要:Score of Parentheses (M) 题目 Given a balanced parentheses string S, compute the score of the string based on the following rule: () has score 1 AB has
阅读全文
摘要:Search a 2D Matrix II (M) 题目 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Inte
阅读全文
摘要:Longest Word in Dictionary through Deleting (M) 题目 Given a string and a string dictionary, find the longest string in the dictionary that can be forme
阅读全文
摘要:Broken Calculator (M) 题目 On a broken calculator that has a number showing on its display, we can perform two operations: Double: Multiply the number o
阅读全文
摘要:Minimum Remove to Make Valid Parentheses (M) 题目 Given a string s of '(' , ')' and lowercase English characters. Your task is to remove the minimum num
阅读全文
摘要:Arithmetic Slices (M) 题目 A sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two co
阅读全文
摘要:Letter Case Permutation (M) 题目 Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Ret
阅读全文
摘要:The K Weakest Rows in a Matrix (E) 题目 Given a m * n matrix mat of ones (representing soldiers) and zeros (representing civilians), return the indexes
阅读全文
摘要:Is Graph Bipartite? (M) 题目 Given an undirected graph, return true if and only if it is bipartite. Recall that a graph is bipartite if we can split its
阅读全文
摘要:Shortest Path in Binary Matrix (M) 题目 In an N by N square grid, each cell is either empty (0) or blocked (1). A clear path from top-left to bottom-rig
阅读全文

浙公网安备 33010602011771号