- 博客(44)
- 收藏
- 关注
原创 [Leetcode] 730. Count Different Palindromic Subsequences 解题报告
题目:Given a string S, find the number of different non-empty palindromic subsequences in S, and return that number modulo 10^9 + 7.A subsequence of a string S is obtained by deleting 0 or m
2018-02-28 22:14:03 768
原创 [Leetcode] 729. My Calendar I 解题报告
题目:Implement a MyCalendar class to store your events. A new event can be added if adding the event will not cause a double booking.Your class will have the method, book(int start, int end)
2018-02-26 17:40:10 323
原创 [Leetcode] 728. Self Dividing Numbers 解题报告
题目:A self-dividing number is a number that is divisible by every digit it contains.For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.Also,
2018-02-26 16:13:49 200
原创 [Leetcode] 727. Minimum Window Subsequence 解题报告
题目:Given strings S and T, find the minimum (contiguous) substring W of S, so that T is a subsequence of W.If there is no such window in S that covers all characters in T, return the em
2018-02-26 16:01:18 2414
原创 [Leetcode] 726. Number of Atoms 解题报告
题目:Given a chemical formula (given as a string), return the count of each atom.An atomic element always starts with an uppercase character, then zero or more lowercase letters, representing
2018-02-17 13:12:51 743
原创 [Leetcode] 725. Split Linked List in Parts 解题报告
题目:Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts".The length of each part should be as equal as possible
2018-02-17 11:17:55 244
原创 [Leetcode] 724. Find Pivot Index 解题报告
题目:Given an array of integers nums, write a method that returns the "pivot" index of this array.We define the pivot index as the index where the sum of the numbers to the left of the index
2018-02-17 10:44:58 304
原创 [Leetcode] 723. Candy Crush 解题报告
题目:This question is about implementing a basic elimination algorithm for Candy Crush.Given a 2D integer array board representing the grid of candy, different positive integers board[i][j] re
2018-02-17 08:39:08 2812
原创 [Leetcode] 722. Remove Comments 解题报告
题目:Given a C++ program, remove comments from it. The program source is an array where source[i] is the i-th line of the source code. This represents the result of splitting the original sour
2018-02-16 19:02:49 628
原创 [Leetcode] 721. Accounts Merge 解题报告
题目:Given a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of the account.No...
2018-02-16 17:30:34 1018 1
原创 [Leetcode] 720. Longest Word in Dictionary 解题报告
题目:Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in words. If there is more than o
2018-02-15 15:44:11 317
原创 [Leetcode] 719. Find K-th Smallest Pair Distance 解题报告
题目:Given an integer array, return the k-th smallest distance among all the pairs. The distance of a pair (A, B) is defined as the absolute difference between A and B.Example 1:Input:num
2018-02-15 14:47:48 1102
原创 [Leetcode] 718. Maximum Length of Repeated Subarray 解题报告
题目:Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example 1:Input:A: [1,2,3,2,1]B: [3,2,1,4,7]Output: 3Explanation: The rep
2018-02-15 13:53:44 201
原创 [Leetcode] 717. 1-bit and 2-bit Characters 解题报告
题目:We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).Now given a string represented by sev
2018-02-15 12:00:49 267
原创 [Leetcode] 716. Max Stack 解题报告
题目:Design a max stack that supports push, pop, top, peekMax and popMax.push(x) -- Push element x onto stack.pop() -- Remove the element on top of the stack and return it.top() -- Get the
2018-02-15 11:41:34 1447
原创 [Leetcode] 715. Range Module 解题报告
题目:A Range Module is a module that tracks ranges of numbers. Your task is to design and implement the following interfaces in an efficient manner.addRange(int left, int right) Adds the h
2018-02-15 10:53:47 1093
原创 [Leetcode] 714. Best Time to Buy and Sell Stock with Transaction Fee 解题报告
题目:Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.You may co
2018-02-14 21:48:51 254
原创 [Leetcode] 713. Subarray Product Less Than K 解题报告
题目:Your are given an array of positive integers nums.Count and print the number of (contiguous) subarrays where the product of all the elements in the subarray is less than k.Example 1:
2018-02-07 22:56:47 620
原创 [Leetcode] 712. Minimum ASCII Delete Sum for Two Strings 解题报告
题目:Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal.Example 1:Input: s1 = "sea", s2 = "eat"Output: 231Explanation: Deleting "s" fro
2018-02-07 22:18:16 226
原创 [Leetcode] 711. Number of Distinct Islands II 解题报告
题目:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the gr
2018-02-07 18:29:27 4549
原创 [Leetcode] 699. Falling Squares 解题报告
题目:On an infinite number line (x-axis), we drop given squares in the order they are given.The i-th square dropped (positions[i] = (left, side_length)) is a square with the left-most point
2018-02-05 20:38:16 572
原创 [Leetcode] 698. Partition to K Equal Sum Subsets 解题报告
题目:Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal.Example 1:Input: nums =
2018-02-04 19:10:32 454
原创 [Leetcode] 697. Degree of an Array 解题报告
题目:Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.Your task is to find the smallest possible
2018-02-03 21:36:36 275
原创 [Leetcode] 696. Count Binary Substrings 解题报告
题目:Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutivel
2018-02-03 21:18:47 222
原创 [Leetcode] 695. Max Area of Island 解题报告
题目:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the gr
2018-02-03 21:05:46 187
原创 [Leetcode] 694. Number of Distinct Islands 解题报告
题目:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the gr
2018-02-03 20:55:14 2044
原创 [Leetcode] 693. Binary Number with Alternating Bits 解题报告
题目:Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.Example 1:Input: 5Output: TrueExplanation:The binary
2018-02-03 18:34:49 205
原创 [Leetcode] 692. Top K Frequent Words 解题报告
题目:Given a non-empty list of words, return the k most frequent elements.Your answer should be sorted by frequency from highest to lowest. If two words have the same frequency, then the word
2018-02-03 18:22:27 1053 1
原创 [Leetcode] 691. Stickers to Spell Word 解题报告
题目:We are given N different types of stickers. Each sticker has a lowercase English word on it.You would like to spell out the given target string by cutting individual letters from your c
2018-02-03 17:50:24 1071
原创 [Leetcode] 690. Employee Importance 解题报告
题目:You are given a data structure of employee information, which includes the employee's unique id, his importance value and his directsubordinates' id.For example, employee 1 is the leade
2018-02-03 10:19:57 230
原创 [Leetcode] 689. Maximum Sum of 3 Non-Overlapping Subarrays 解题报告
题目:In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum.Each subarray will be of size k, and we want to maximize the sum of all 3*k entries.
2018-02-03 09:58:12 421
原创 [Leetcode] 688. Knight Probability in Chessboard 解题报告
题目:On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and columns are 0 indexed, so the top-left square is (0, 0), and the
2018-02-02 21:07:11 333
原创 [Leetcode] 687. Longest Univalue Path 解题报告
题目:Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root.Note: The length of path between tw
2018-02-02 18:38:14 200
原创 [Leetcode] 686. Repeated String Match 解题报告
题目:Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1.For example, with A = "abcd" and B = "cda
2018-02-02 17:56:52 328
原创 [Leetcode] 685. Redundant Connection II 解题报告
题目:In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of this node, plus every node has exactly one pare
2018-02-02 17:18:10 1988
原创 [Leetcode] 684. Redundant Connection 解题报告
题目:In this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a graph that started as a tree with N nodes (with distinct values 1, 2, ..., N), with
2018-02-02 11:07:54 390
原创 [Leetcode] 683. K Empty Slots 解题报告
题目:There is a garden with N slots. In each slot, there is a flower. The N flowers will bloom one by one in N days. In each day, there will be exactly one flower blooming and it will be in th
2018-02-02 10:39:35 1413
原创 [Leetcode] 682. Baseball Game 解题报告
题目:You're now a baseball game point recorder.Given a list of strings, each string can be one of the 4 following types:Integer (one round's score): Directly represents the number of point
2018-02-02 09:36:40 239
原创 [Leetcode] 681. Next Closest Time 解题报告
题目:Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no limit on how many times a digit can be reused.You may assume the give
2018-02-01 23:57:06 1572 1
原创 [Leetcode] 680. Valid Palindrome II 解题报告
题目:Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.Example 1:Input: "aba"Output: TrueExample 2:Input: "abca"
2018-02-01 22:59:08 560
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人