随笔分类 -  Level 1

摘要:Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairs pairs, determine if two sentences are s 阅读全文
posted @ 2020-02-06 12:22 北叶青藤 阅读(192) 评论(0) 推荐(0)
摘要:Suppose we have very large sparse vectors (most of the elements in vector are zeros) Find a data structure to store them Compute the Dot Product. Foll 阅读全文
posted @ 2020-02-06 11:33 北叶青藤 阅读(312) 评论(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)
摘要:Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Input: "aba" Output: True Exa 阅读全文
posted @ 2020-02-04 01:16 北叶青藤 阅读(123) 评论(0) 推荐(0)
摘要:In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permu 阅读全文
posted @ 2020-01-30 14:39 北叶青藤 阅读(286) 评论(0) 推荐(0)
摘要:You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose o 阅读全文
posted @ 2019-08-19 03:51 北叶青藤 阅读(268) 评论(0) 推荐(0)
摘要:Error Retries and Exponential Backoff in AWS https://docs.aws.amazon.com/general/latest/gr/api-retries.html Numerous components on a network, such as 阅读全文
posted @ 2019-08-19 01:56 北叶青藤 阅读(430) 评论(0) 推荐(0)
摘要:Recurrence Algorithm Big-Oh Solution T(n) = T(n/2) + O(1) Binary SearchO(log n)T(n) = T(n-1) + O(1) Sequential SearchO(n)T(n) = 2 T(n/2) + O(1) Tree T 阅读全文
posted @ 2019-08-19 01:43 北叶青藤 阅读(189) 评论(0) 推荐(0)
摘要:Design and implement a data structure for a compressed string iterator. It should support the following operations: next and hasNext. The given compre 阅读全文
posted @ 2019-08-12 05:14 北叶青藤 阅读(182) 评论(0) 推荐(0)
摘要:Find the second largest node in the BST 分析: 如果root有右节点,很明显第二大的node有可能在右子树里。唯一不满足的条件就是右子树只有一个node. 这个时候root就是第二大node. 所以我们需要把root(可能是第二大node)也传下去。 如果ro 阅读全文
posted @ 2019-07-30 13:23 北叶青藤 阅读(174) 评论(0) 推荐(0)
摘要:Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order. Examp 阅读全文
posted @ 2019-07-19 13:43 北叶青藤 阅读(244) 评论(0) 推荐(0)
摘要:In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as much as 阅读全文
posted @ 2019-07-08 05:10 北叶青藤 阅读(203) 评论(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)
摘要: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)
摘要:An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr, 阅读全文
posted @ 2019-07-03 03:23 北叶青藤 阅读(192) 评论(0) 推荐(0)
摘要:Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the or 阅读全文
posted @ 2019-06-09 10:37 北叶青藤 阅读(129) 评论(0) 推荐(0)
摘要:Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's 阅读全文
posted @ 2019-04-28 12:46 北叶青藤 阅读(214) 评论(0) 推荐(0)
摘要:Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers 阅读全文
posted @ 2019-04-28 11:36 北叶青藤 阅读(123) 评论(0) 推荐(0)
摘要:Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: Note: You may assume the 阅读全文
posted @ 2019-03-24 08:54 北叶青藤 阅读(141) 评论(0) 推荐(0)
摘要:Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2019-03-04 04:10 北叶青藤 阅读(164) 评论(0) 推荐(0)