随笔分类 -  LeetCode

摘要:Given a m x n grid. Each cell of the grid has a sign pointing to the next cell you should visit if you are currently in this cell. The sign of grid[i] 阅读全文
posted @ 2020-03-02 08:23 Review->Improve 阅读(1029) 评论(0) 推荐(0)
摘要:Given an array A of positive integers, call a (contiguous, not necessarily distinct) subarray of A good if the number of different integers in that su 阅读全文
posted @ 2020-02-04 11:41 Review->Improve 阅读(309) 评论(0) 推荐(0)
摘要:We are given an array A of N lowercase letter strings, all of the same length. Now, we may choose any set of deletion indices, and for each string, we 阅读全文
posted @ 2020-02-04 06:23 Review->Improve 阅读(334) 评论(0) 推荐(0)
摘要:You have some sticks with positive integer lengths. You can connect any two sticks of lengths X and Y into one stick by paying a cost of X + Y. You pe 阅读全文
posted @ 2020-01-24 05:55 Review->Improve 阅读(440) 评论(0) 推荐(0)
摘要: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.) Yo 阅读全文
posted @ 2020-01-24 03:37 Review->Improve 阅读(840) 评论(0) 推荐(0)
摘要:Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two 阅读全文
posted @ 2019-12-09 08:40 Review->Improve 阅读(1372) 评论(2) 推荐(1)
摘要:Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two 阅读全文
posted @ 2019-12-09 08:23 Review->Improve 阅读(441) 评论(0) 推荐(0)
摘要:You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that a 阅读全文
posted @ 2019-12-05 01:24 Review->Improve 阅读(137) 评论(0) 推荐(0)
摘要:(This problem is an interactive problem.) On the sea represented by a cartesian plane, each ship is located at an integer point, and each integer poin 阅读全文
posted @ 2019-12-03 00:38 Review->Improve 阅读(1991) 评论(0) 推荐(0)
摘要:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to count the total strobog 阅读全文
posted @ 2019-11-24 02:41 Review->Improve 阅读(270) 评论(0) 推荐(0)
摘要:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Find all strobogrammatic numbers that are o 阅读全文
posted @ 2019-11-24 02:38 Review->Improve 阅读(233) 评论(0) 推荐(0)
摘要:You are given a string containing only 4 kinds of characters 'Q', 'W', 'E' and 'R'. A string is said to be balanced if each of its characters appears  阅读全文
posted @ 2019-10-21 22:30 Review->Improve 阅读(1256) 评论(0) 推荐(0)
摘要:Given an array nums of positive integers, return the longest possible length of an array prefix of nums, such that it is possible to remove exactly on 阅读全文
posted @ 2019-10-14 03:10 Review->Improve 阅读(758) 评论(0) 推荐(0)
摘要:A die simulator generates a random number from 1 to 6 for each roll. You introduced a constraint to the generator such that it cannot roll the number  阅读全文
posted @ 2019-10-14 01:42 Review->Improve 阅读(1460) 评论(0) 推荐(0)
摘要:Your music player contains N different songs and she wants to listen to L (not necessarily different) songs during your trip. You create a playlist so 阅读全文
posted @ 2019-10-11 11:09 Review->Improve 阅读(336) 评论(0) 推荐(0)
摘要:Given the head of a linked list, we repeatedly delete consecutive sequences of nodes that sum to 0 until there are no such sequences. After doing so, 阅读全文
posted @ 2019-09-29 07:04 Review->Improve 阅读(889) 评论(0) 推荐(0)
摘要:Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input:nums = 阅读全文
posted @ 2019-09-29 06:26 Review->Improve 阅读(439) 评论(0) 推荐(0)
摘要:In an infinite chess board with coordinates from -infinity to +infinity, you have a knight at square [0, 0]. A knight has 8 possible moves it can make 阅读全文
posted @ 2019-09-22 01:23 Review->Improve 阅读(5799) 评论(0) 推荐(0)
摘要:Given an array of integers, return the maximum sum for a non-empty subarray (contiguous elements) with at most one element deletion. In other words, y 阅读全文
posted @ 2019-09-16 23:31 Review->Improve 阅读(1105) 评论(0) 推荐(0)
摘要:Given a string s, we make queries on substrings of s. For each query queries[i] = [left, right, k], we may rearrange the substring s[left], ..., s[rig 阅读全文
posted @ 2019-09-04 23:28 Review->Improve 阅读(881) 评论(0) 推荐(0)