随笔分类 -  Level 2

上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页
摘要:Given an array with distinct numbers, return an integer indicating the minimum number of swap operations required to sort the array into ascending ord 阅读全文
posted @ 2019-08-04 08:48 北叶青藤 阅读(211) 评论(0) 推荐(0)
摘要:A conveyor belt has packages that must be shipped from one port to another within D days. The i-th package on the conveyor belt has a weight of weight 阅读全文
posted @ 2019-08-02 14:38 北叶青藤 阅读(275) 评论(0) 推荐(0)
摘要: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.T 阅读全文
posted @ 2019-08-02 12:53 北叶青藤 阅读(148) 评论(0) 推荐(0)
摘要:Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warme 阅读全文
posted @ 2019-08-01 13:56 北叶青藤 阅读(186) 评论(0) 推荐(0)
摘要:You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You can only move up, down, left and right. 阅读全文
posted @ 2019-07-29 03:11 北叶青藤 阅读(279) 评论(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-07-28 03:44 北叶青藤 阅读(282) 评论(0) 推荐(0)
摘要:Two strings X and Y are similar if we can swap two letters (in different positions) of X, so that it equals Y. For example, "tars" and "rats" are simi 阅读全文
posted @ 2019-07-28 01:36 北叶青藤 阅读(249) 评论(0) 推荐(0)
摘要:Design a hit counter which counts the number of hits received in the past 5 minutes. Each function accepts a timestamp parameter (in seconds granularity) and you may assume that calls are being made ... 阅读全文
posted @ 2019-07-26 13:53 北叶青藤 阅读(197) 评论(0) 推荐(0)
摘要:You are given several logs that each log contains a unique id and timestamp. Timestamp is a string that has the following format: Year:Month:Day:Hour: 阅读全文
posted @ 2019-07-25 14:42 北叶青藤 阅读(327) 评论(0) 推荐(0)
摘要:Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping. Note: You 阅读全文
posted @ 2019-07-23 12:45 北叶青藤 阅读(316) 评论(0) 推荐(0)
摘要:Example : Infix : (A+B) * (C-D) ) Postfix: AB+CD-* 算法: 1. Scan the infix expression from left to right. 2. If the scanned character is an operand, app 阅读全文
posted @ 2019-07-22 13:40 北叶青藤 阅读(356) 评论(0) 推荐(0)
摘要:Given a list of strings, output the most frequent characters that are in the same group as the letter. For example, for string "abc", a, b,c are in th 阅读全文
posted @ 2019-07-22 13:02 北叶青藤 阅读(356) 评论(0) 推荐(0)
摘要: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 s 阅读全文
posted @ 2019-07-20 16:08 北叶青藤 阅读(274) 评论(0) 推荐(0)
摘要:In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you will travel is given 阅读全文
posted @ 2019-07-19 14:32 北叶青藤 阅读(282) 评论(0) 推荐(0)
摘要:Given a positive integer N, how many ways can we write it as a sum of consecutive positive integers? Example 1: Example 2: Example 3: 分析:https://leetc 阅读全文
posted @ 2019-07-15 11:09 北叶青藤 阅读(308) 评论(0) 推荐(0)
摘要:Design a HashMap without using any built-in hash table libraries. To be specific, your design should include these functions: put(key, value) : Insert 阅读全文
posted @ 2019-07-15 10:54 北叶青藤 阅读(214) 评论(0) 推荐(0)
摘要:Given an array w of positive integers, where w[i] describes the weight of index i, write a function pickIndex which randomly picks an index in proport 阅读全文
posted @ 2019-07-15 09:19 北叶青藤 阅读(110) 评论(0) 推荐(0)
摘要:Given two lists of closed intervals, each list of intervals is pairwise disjoint and in sorted order. Return the intersection of these two interval li 阅读全文
posted @ 2019-07-15 09:03 北叶青藤 阅读(370) 评论(0) 推荐(0)
摘要:You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be rep 阅读全文
posted @ 2019-07-08 06:32 北叶青藤 阅读(165) 评论(0) 推荐(0)
摘要:In English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. For 阅读全文
posted @ 2019-07-08 05:36 北叶青藤 阅读(188) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页