06 2017 档案
摘要:Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could
阅读全文
摘要:Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2: Inp
阅读全文
摘要:Given a positive integer a, find the smallest positive integer b whose multiplication of each digit equals to a. If there is no answer or the answer i
阅读全文
摘要:Given m arrays, and each array is sorted in ascending order. Now you can pick up two integers from two different arrays (each array picks one) and cal
阅读全文
摘要:Given the root of a binary tree, then value v and depth d, you need to add a row of nodes with value v at the given depth d. The root node is at depth
阅读全文
摘要:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n
阅读全文
摘要:Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the array that can make triangles if we tak
阅读全文
摘要:Given a string s and a list of strings dict, you need to add a closed pair of bold tag <b> and </b> to wrap the substrings in s that exist in dict. If
阅读全文
摘要:Design and implement a data structure for a compressed string iterator. It should support the following operations: next and hasNext. The given compre
阅读全文
摘要:Given a string representing a code snippet, you need to implement a tag validator to parse the code and return whether it is valid. A code snippet is
阅读全文
摘要: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
阅读全文
摘要:You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be rep
阅读全文
摘要:这篇小结主要是参考这篇帖子从头到尾彻底理解KMP,不得不佩服原作者,写的真是太详尽了,让博主产生了一种读学术论文的错觉。后来发现原作者是写书的,不由得更加敬佩了。博主不才,尝试着简化一些原帖子的内容,希望能更通俗易懂一些。博主的帖子一贯秉持通俗易懂的风格,使得非CS专业的人士也能读懂,至少博主自己是
阅读全文
摘要:Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they
阅读全文
摘要:Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You need to h
阅读全文
摘要:Given an m * n matrix M initialized with all 0's and several update operations. Operations are represented by a 2D array, and each operation is repres
阅读全文
摘要:Given a positive integer n, find the number of non-negative integers less than or equal to n, whose binary representations do NOT contain consecutive
阅读全文
摘要:Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final
阅读全文
摘要: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
阅读全文
摘要:You are given an integer array nums of length n where nums is a permutation of the numbers in the range [0, n - 1]. You should build a set s[k] = {num
阅读全文
摘要:There is an m by n grid with a ball. Given the start coordinate (i,j) of the ball, you can move the ball to adjacent cell or cross the grid boundary i
阅读全文