随笔分类 -  List

摘要:You have a browser of one tab where you start on the homepage and you can visit another url, get back in the history number of steps or move forward i 阅读全文
posted @ 2021-06-21 09:44 北叶青藤 阅读(37) 评论(0) 推荐(0)
摘要:Given a node from a Circular Linked List which is sorted in ascending order, write a function to insert a value insertVal into the list such that it r 阅读全文
posted @ 2021-03-15 11:17 北叶青藤 阅读(60) 评论(0) 推荐(0)
摘要:Given two binary search trees root1 and root2. Return a list containing all the integers from both trees sorted in ascending order. Example 1: Input: 阅读全文
posted @ 2020-02-06 09:39 北叶青藤 阅读(529) 评论(0) 推荐(0)
摘要:Design your implementation of the linked list. You can choose to use the singly linked list or the doubly linked list. A node in a singly linked list 阅读全文
posted @ 2019-08-11 02:58 北叶青藤 阅读(261) 评论(0) 推荐(0)
摘要:Design a Phone Directory which supports the following operations: get: Provide a number which is not assigned to anyone.check: Check if a number is av 阅读全文
posted @ 2019-08-11 02:21 北叶青藤 阅读(206) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-07-31 14:10 北叶青藤 阅读(206) 评论(0) 推荐(0)
摘要:Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: getand put. get(key) - Get th 阅读全文
posted @ 2019-07-17 12:48 北叶青藤 阅读(232) 评论(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)
摘要:Whenever you expose a web service / api endpoint, you need to implement a rate limiter to prevent abuse of the service (DOS attacks). Implement a Rate 阅读全文
posted @ 2019-07-08 00:33 北叶青藤 阅读(207) 评论(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)
摘要:Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the 阅读全文
posted @ 2016-12-28 12:54 北叶青藤 阅读(216) 评论(0) 推荐(0)
摘要:Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek()operation -- it es 阅读全文
posted @ 2016-08-06 08:26 北叶青藤 阅读(241) 评论(0) 推荐(0)
摘要:Implement an iterator to flatten a 2d vector. For example, Given 2d vector = By calling next repeatedly until hasNext returns false, the order of elem 阅读全文
posted @ 2016-08-05 04:04 北叶青藤 阅读(176) 评论(0) 推荐(0)
摘要:Nested List Weight Sum I Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either a 阅读全文
posted @ 2016-08-01 02:55 北叶青藤 阅读(327) 评论(0) 推荐(0)
摘要:Given a non-negative number represented as a singly linked list of digits, plus one to the number. The digits are stored such that the most significan 阅读全文
posted @ 2016-07-26 00:25 北叶青藤 阅读(199) 评论(0) 推荐(0)
摘要:The size of the hash table is not determinate at the very beginning. If the total size of keys is too large (e.g. size >= capacity / 10), we should do 阅读全文
posted @ 2016-07-23 05:53 北叶青藤 阅读(366) 评论(0) 推荐(0)
摘要:Given an directed graph, a topological order of the graph nodes is defined as follow: For each directed edge A -> B in graph, A must before B in the o 阅读全文
posted @ 2016-07-22 09:56 北叶青藤 阅读(198) 评论(0) 推荐(0)
摘要:Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integ 阅读全文
posted @ 2016-07-22 00:28 北叶青藤 阅读(213) 评论(0) 推荐(0)
摘要:Add Two Numbers I You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, 阅读全文
posted @ 2016-07-16 00:11 北叶青藤 阅读(228) 评论(0) 推荐(0)
摘要:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the 阅读全文
posted @ 2016-07-15 22:48 北叶青藤 阅读(379) 评论(0) 推荐(0)