自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(411)
  • 收藏
  • 关注

原创 307. Range Sum Query - Mutable

DescriptionGiven an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.The update(i, val) function modifies nums by updating the element at index i to val.E...

2018-11-26 14:02:17 269

原创 911. Online Election

DescriptionIn an election, the i-th vote was cast for persons[i] at time times[i].Now, we would like to implement the following query function: TopVotedCandidate.q(int t) will return the number of t...

2018-11-24 07:47:56 360

原创 926. Flip String to Monotone Increasing

DescriptionA string of '0’s and '1’s is monotone increasing if it consists of some number of '0’s (possibly 0), followed by some number of '1’s (also possibly 0.)We are given a string S of '0’s and ...

2018-11-23 10:03:44 275

原创 933. Number of Recent Calls

DescriptionWrite a class RecentCounter to count recent requests.It has only one method: ping(int t), where t represents some time in milliseconds.Return the number of pings that have been made from...

2018-11-23 09:13:33 279

原创 939. Minimum Area Rectangle

DescriptionGiven a set of points in the xy-plane, determine the minimum area of a rectangle formed from these points, with sides parallel to the x and y axes.If there isn’t any rectangle, return 0....

2018-11-23 04:40:37 273

原创 890. Find and Replace Pattern

DescriptionYou have a list of words and a pattern, and you want to know which words in words matches the pattern.A word matches the pattern if there exists a permutation of letters p so that after r...

2018-11-22 16:55:42 196

原创 853. Car Fleet

DescriptionN cars are going to the same destination along a one lane road. The destination is target miles away.Each car i has a constant speed speed[i] (in miles per hour), and initial position po...

2018-11-22 16:37:08 370

原创 849. Maximize Distance to Closest Person

DescriptionIn a row of seats, 1 represents a person sitting in that seat, and 0 represents that the seat is empty.There is at least one empty seat, and at least one person sitting.Alex wants to sit...

2018-11-22 16:03:58 160

原创 846. Hand of Straights

DescriptionAlice has a hand of cards, given as an array of integers.Now she wants to rearrange the cards into groups so that each group is size W, and consists of W consecutive cards.Return true if...

2018-11-22 15:33:02 201

原创 837. New 21 Game

DescriptionAlice plays the following game, loosely based on the card game “21”.Alice starts with 0 points, and draws numbers while she has less than K points. During each draw, she gains an integer...

2018-11-22 14:24:55 257

原创 834. Sum of Distances in Tree

DescriptionAn undirected, connected tree with N nodes labelled 0…N-1 and N-1 edges are given.The ith edge connects nodes edges[i][0] and edges[i][1] together.Return a list ans, where ans[i] is the ...

2018-11-22 12:23:07 209

原创 815. Bus Routes

DescriptionWe have a list of bus routes. Each routes[i] is a bus route that the i-th bus repeats forever. For example if routes[0] = [1, 5, 7], this means that the first bus (0-th indexed) travels in...

2018-11-22 03:39:57 214

原创 774. Minimize Max Distance to Gas Station

DescriptionOn a horizontal number line, we have gas stations at positions stations[0], stations[1], …, stations[N-1], where N = stations.length.Now, we add K more gas stations so that D, the maximum...

2018-11-22 03:01:59 234

原创 769. Max Chunks To Make Sorted

DescriptionGiven an array arr that is a permutation of [0, 1, …, arr.length - 1], we split the array into some number of “chunks” (partitions), and individually sort each chunk. After concatenating ...

2018-11-21 16:27:01 152

原创 750. Number Of Corner Rectangles

DescriptionGiven a grid where each entry is only 0 or 1, find the number of corner rectangles.A corner rectangle is 4 distinct 1s on the grid that form an axis-aligned rectangle. Note that only the ...

2018-11-21 14:49:43 210

原创 731. My Calendar II

DescriptionImplement a MyCalendarTwo class to store your events. A new event can be added if adding the event will not cause a triple booking.Your class will have one method, book(int start, int end...

2018-11-21 14:29:53 215

原创 685. Redundant Connection II

DescriptionIn 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 p...

2018-11-21 11:02:12 203

原创 684. Redundant Connection

DescriptionIn 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 o...

2018-11-21 10:25:17 211

原创 109. Convert Sorted List to Binary Search Tree

问题描述Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in which ...

2018-11-20 13:30:07 113

原创 676. Implement Magic Dictionary

问题描述Implement a magic directory with buildDict, and search methods.For the method buildDict, you’ll be given a list of non-repetitive words to build a dictionary.For the method search, you’ll be gi...

2018-11-20 13:26:19 107

原创 659. Split Array into Consecutive Subsequences

问题描述You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subsequences consist of at least 3 consecutive inte...

2018-11-20 06:23:37 173

原创 642. Design Search Autocomplete System

问题描述Design a search autocomplete system for a search engine. Users may input a sentence (at least one word and end with a special character ‘#’). For each character they type except ‘#’, you need to ...

2018-11-20 03:58:13 638

原创 505. The Maze II

问题描述There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolling up, down, left or right, but it won’t stop rolling until hitting a wall. When the ball stops...

2018-11-19 15:28:38 454

原创 486. Predict the Winner

DescriptionGiven 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 and then player 1 and so on. Each time a pl...

2018-11-19 13:18:46 107

原创 418. Sentence Screen Fitting

DescriptionGiven a rows x cols screen and a sentence represented by a list of non-empty words, find how many times the given sentence can be fitted on the screen.Note:A word cannot be split into tw...

2018-11-19 09:56:50 260

原创 340. Longest Substring with At Most K Distinct Characters

DescriptionGiven a string, find the length of the longest substring T that contains at most k distinct characters.Example 1:Input: s = “eceba”, k = 2Output: 3Explanation: T is “ece” which its len...

2018-11-19 03:16:04 195

原创 337. House Robber III

DescriptionThe thief has found himself a new place for his thievery again. There is only one entrance to this area, called the “root.” Besides the root, each house has one and only one parent house. ...

2018-11-19 01:54:13 138

原创 490. The Maze

####问题描述There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolling up, down, left or right, but it won’t stop rolling until hitting a wall. When the ball s...

2018-11-18 09:59:48 378

原创 79. Word Search

DescriptionGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or v...

2018-11-18 09:50:09 128

原创 698. Partition to K Equal Sum Subsets

DescriptionGiven 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 = [4, 3,...

2018-11-16 15:56:08 146

原创 250. Count Univalue Subtrees

DescriptionGiven a binary tree, count the number of uni-value subtrees.A Uni-value subtree means all nodes of the subtree have the same value.Example :Input: root = [5,1,5,5,5,null,5] 5...

2018-11-16 15:03:33 132

原创 567. Permutation in String

DescriptionGiven two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string’s permutations is the substring of the second str...

2018-11-16 14:34:56 132

原创 334. Increasing Triplet Subsequence

DescriptionGiven an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the function should:Return true if there exists i, j, ksuch that arr[i] ...

2018-11-16 14:18:06 131

原创 468. Validate IP Address

DescriptionWrite a function to check whether an input string is a valid IPv4 address or IPv6 address or neither.IPv4 addresses are canonically represented in dot-decimal notation, which consists of ...

2018-11-15 13:55:53 192

原创 523. Continuous Subarray Sum

DescriptionGiven a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multiple of k, that is,...

2018-11-15 13:53:50 192

原创 244. Shortest Word Distance II

DescriptionDesign a class which receives a list of words in the constructor, and implements a method that takes two words word1 and word2 and return the shortest distance between these two words in t...

2018-11-15 13:29:41 204

原创 148. Sort List

DescriptionSort a linked list in O(n log n) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5->3->4->0Output...

2018-11-15 13:21:41 261 1

原创 261. Graph Valid Tree

DescriptionGiven n nodes labeled from 0 to n-1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree.Example 1:Input: n =...

2018-11-14 06:41:22 192

原创 733. Flood Fill

DescriptionAn image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535).Given a coordinate (sr, sc) representing the starting pixel (r...

2018-11-14 02:39:34 191

原创 863. All Nodes Distance K in Binary Tree

DescriptionWe are given a binary tree (with root node root), a target node, and an integer value K.Return a list of the values of all nodes that have a distance K from the target node. The answer c...

2018-11-13 15:42:02 296 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除