文章平均质量分 78
dongbeier
这个作者很懒,什么都没留下…
展开
-
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 given input strin...原创 2018-07-01 10:00:33 · 262 阅读 · 0 评论 -
200 Number of Islands
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume...原创 2018-06-14 06:39:01 · 163 阅读 · 0 评论 -
218 The Skyline Problem
A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are given the locations and height of all the buildings as...原创 2018-06-14 06:38:30 · 126 阅读 · 0 评论 -
568 Maximum Vacation Days
LeetCode wants to give one of its best employees the option to travel among N cities to collect algorithm problems. But all work and no play makes Jack a dull boy, you could take vacations in some par...原创 2018-07-03 12:27:09 · 274 阅读 · 0 评论 -
340 Longest Substring with At Most K Distinct Characters
Given a string, find the length of the longest substring T that contains at most k distinct characters.For example, Given s = “eceba” and k = 2,T is "ece" which its length is 3.这道题给我们一个字符串,让我们求最多有两个不同...原创 2018-07-01 10:00:23 · 395 阅读 · 0 评论 -
482 License Key Formatting
You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes.Given a number K, we would want to refo...原创 2018-07-01 10:00:09 · 166 阅读 · 0 评论 -
308 Range Sum Query 2D - Mutable
Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2).The above rectangle (with the red border) ...原创 2018-07-01 10:01:47 · 257 阅读 · 0 评论 -
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 = "cdabcdab".Return...原创 2018-07-03 12:28:47 · 119 阅读 · 0 评论 -
346 Moving Average from Data Stream
Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window.For example,MovingAverage m = new MovingAverage(3);m.next(1) = 1m.next(10) = (1 + 10) /...原创 2018-07-03 12:28:57 · 181 阅读 · 0 评论 -
298 Binary Tree Longest Consecutive Sequence
Given a binary tree, find the length of the longest consecutive sequence path. The path refers to any sequence of nodes from some starting node to any node in the tree along the parent-child connectio...原创 2018-07-03 12:29:08 · 235 阅读 · 0 评论 -
418 Sentence Screen Fitting
Given a rows x cols screen and a sentence represented by a list of words, find how many times the given sentence can be fitted on the screen.Note:A word cannot be split into two lines.The order of wor...原创 2018-07-03 12:40:21 · 293 阅读 · 0 评论 -
281 Zigzag Iterator
Given two 1d vectors, implement an iterator to return their elements alternately.For example, given two 1d vectors:v1 = [1, 2]v2 = [3, 4, 5, 6]By calling next repeatedly until hasNext returns false,...原创 2018-07-03 12:40:10 · 187 阅读 · 0 评论 -
Bomb Enemy
Given a 2D grid, each cell is either a wall 'W', an enemy 'E' or empty '0' (the number zero), return the maximum enemies you can kill using one bomb.The bomb kills all the enemies in the same row and ...原创 2018-07-03 12:28:34 · 247 阅读 · 0 评论 -
394 Decode String
Given an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guara...原创 2018-07-03 12:28:24 · 307 阅读 · 0 评论 -
393 UTF-8 Validation
A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:For 1-byte character, the first bit is a 0, followed by its unicode code.For n-bytes character, the first n-bits are...原创 2018-07-03 12:28:07 · 128 阅读 · 0 评论 -
163 Missing Ranges
Given a sorted integer array where the range of elements are [0, 99] inclusive, return its missing ranges.For example, given [0, 1, 3, 50, 75], return [“2”, “4->49”, “51->74”, “76->99”] 这道题让我...原创 2018-07-03 12:27:51 · 235 阅读 · 0 评论 -
568 Maximum Vacation Days
LeetCode wants to give one of its best employees the option to travel among N cities to collect algorithm problems. But all work and no play makes Jack a dull boy, you could take vacations in some par...原创 2018-07-03 12:27:41 · 120 阅读 · 0 评论 -
66 Plus One
Given a non-empty array of digits representing a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the list, and each element i...原创 2018-07-03 12:27:21 · 111 阅读 · 0 评论 -
616 Add Bold Tag in String
Given a string s and a list of strings dict, you need to add a closed pair of bold tag <b> and </b> to wrap the substrings in s that exist in dict. If two such substrings overlap, you need...原创 2018-07-03 13:22:12 · 234 阅读 · 0 评论 -
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 two nodes is re...原创 2018-07-03 12:59:43 · 173 阅读 · 0 评论 -
351 Android Unlock Patterns
Given an Android 3x3 key lock screen and two integers m and n, where 1 ≤ m ≤ n ≤ 9, count the total number of unlock patterns of the Android lock screen, which consist of minimum of m keys and maximum...原创 2018-07-03 12:55:08 · 229 阅读 · 0 评论