随笔分类 - Snapchat
摘要:Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1. For example, 123 -> "One Hundre
阅读全文
摘要:Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. 分析: http://blog.csd
阅读全文
摘要:Given an Android 3x3 key lock screen and two integers m and n, where 1 ≤ m ≤ n ≤ 9, count the total number of unlock patterns of the Android lock scre
阅读全文
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target va
阅读全文
摘要:Spiral Matrix I Given an integer n, generate a square matrix filled with elements from 1 to n^2 in spiral order. Example Given n = 3, You should retur
阅读全文
摘要:Word Ladder I Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that: Onl
阅读全文
摘要:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have
阅读全文
摘要:Given a string source and a string target, find the minimum window in source which will contain all the characters in target. Notice If there is no su
阅读全文
摘要: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
阅读全文
摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
阅读全文
摘要:Insert Intervals Given a non-overlapping interval list which is sorted by start point. Insert a new interval into it, make sure the list is still in o
阅读全文
摘要:Given a boolean 2D matrix, find the number of islands. Notice 0 is represented as the sea, 1 is represented as the island. If two 1 is adjacent, we co
阅读全文
摘要:A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded messag
阅读全文
摘要:Implement a stack with min() function, which will return the smallest number in the stack. It should support push, pop and min operation all in O(1) c
阅读全文
摘要:Reverse Words in a String I Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the".
阅读全文
摘要:Maximum Subarray Given an array of integers, find a contiguous subarray which has the largest sum. Notice The subarray should contain at least one num
阅读全文
摘要:Unique Paths I A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or
阅读全文
摘要:Best Time to Buy and Sell Stock I Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted t
阅读全文
摘要:Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading back f
阅读全文
摘要:Combination Sum | Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to
阅读全文

浙公网安备 33010602011771号