随笔分类 - Level 3
摘要:Given an array A of non-negative integers, return the maximum sum of elements in two non-overlapping (contiguous) subarrays, which have lengths L and
阅读全文
摘要:Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The
阅读全文
摘要:Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or
阅读全文
摘要:Given a 2D grid of 0s and 1s, return the number of elements in the largest square subgrid that has all 1s on its border, or 0 if such a subgrid doesn'
阅读全文
摘要:Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except n
阅读全文
摘要:Assume you have k<=10^5 intervals [a_i, b_i] \in [1,10^18] (some of them may overlap), and you need to choose a set of intervals mutually disjoint suc
阅读全文
摘要:How this game is playe can be found at here. Python ROWS = 6 COLS = 7 def create_board(): return [[' ' for _ in range(COLS)] for _ in range(ROWS)] def
阅读全文
摘要: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 roll
阅读全文
摘要:Design an in-memory file system to simulate the following functions: ls: Given a path in string format. If it is a file path, return a list that only
阅读全文
摘要:Find the longest increasing subsequence in an array. If there are multiple, return one of them. Example, for [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13,
阅读全文
摘要:Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given
阅读全文
摘要:A move consists of taking a point (x, y) and transforming it to either (x, x+y) or (x+y, y). Given a starting point (sx, sy) and a target point (tx, t
阅读全文
摘要:Design a Snake game that is played on a device with screen size = width x height. Play the game online if you are not familiar with the game. The snak
阅读全文
摘要:Given a list of directory info including directory path, and all the files with contents in this directory, you need to find out all the groups of dup
阅读全文
摘要:Given many words, words[i] has weight i. Design a class WordFilter that supports one function, WordFilter.f(String prefix, String suffix). It will ret
阅读全文
摘要:There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the hor
阅读全文
摘要:Implement FreqStack, a class which simulates the operation of a stack-like data structure. FreqStack has two functions: push(int x), which pushes an i
阅读全文
摘要: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
阅读全文
摘要:On a 2x3 board, there are 5 tiles represented by the integers 1 through 5, and an empty square represented by 0. A move consists of choosing 0 and a 4
阅读全文
摘要: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
阅读全文

浙公网安备 33010602011771号