随笔分类 -  Snapchat

摘要:Design a stack which supports the following operations. Implement the CustomStack class: CustomStack(int maxSize) Initializes the object with maxSize  阅读全文
posted @ 2021-04-27 23:00 北叶青藤 阅读(110) 评论(0) 推荐(0)
摘要:Implement a SnapshotArray that supports the following interface: SnapshotArray(int length) initializes an array-like data structure with the given len 阅读全文
posted @ 2019-09-18 12:29 北叶青藤 阅读(411) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-08-23 15:11 北叶青藤 阅读(472) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-08-13 12:34 北叶青藤 阅读(151) 评论(0) 推荐(0)
摘要:Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (F 阅读全文
posted @ 2019-08-11 09:02 北叶青藤 阅读(225) 评论(0) 推荐(0)
摘要:Let's play the minesweeper game (Wikipedia, online game)! You are given a 2D char matrix representing the game board. 'M' represents an unrevealed min 阅读全文
posted @ 2019-08-08 14:41 北叶青藤 阅读(702) 评论(0) 推荐(0)
摘要:You are given a string with lower case letters only. Compress it by putting the count of the letter after it. If the letter appears once, Example: com 阅读全文
posted @ 2019-08-05 04:52 北叶青藤 阅读(279) 评论(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)
摘要: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 阅读全文
posted @ 2019-07-28 03:22 北叶青藤 阅读(631) 评论(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)
摘要: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 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)
摘要: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 阅读全文
posted @ 2019-07-15 05:34 北叶青藤 阅读(520) 评论(0) 推荐(0)
摘要:Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not printed in t 阅读全文
posted @ 2019-07-07 23:40 北叶青藤 阅读(278) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-07-07 13:38 北叶青藤 阅读(489) 评论(0) 推荐(0)
摘要:We are given a list schedule of employees, which represents the working time for each employee. Each employee has a list of non-overlapping Intervals, 阅读全文
posted @ 2019-07-06 22:58 北叶青藤 阅读(253) 评论(0) 推荐(0)
摘要:On a single threaded CPU, we execute some functions. Each function has a unique id between 0 and N-1. We store logs in timestamp order that describe w 阅读全文
posted @ 2019-07-03 03:38 北叶青藤 阅读(225) 评论(0) 推荐(0)
摘要:You have 4 cards each containing a number from 1 to 9. You need to judge whether they could operated through *, /, +, -, (, ) to get the value of 24. 阅读全文
posted @ 2019-04-22 01:04 北叶青藤 阅读(175) 评论(0) 推荐(0)
摘要:Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and 阅读全文
posted @ 2019-03-04 04:08 北叶青藤 阅读(154) 评论(0) 推荐(0)