摘要:
The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another n
阅读全文
posted @ 2017-08-09 11:17
Grandyang
阅读(5306)
推荐(1)
摘要:
Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the
阅读全文
posted @ 2017-08-06 13:54
Grandyang
阅读(7764)
推荐(0)
摘要:
A message containing letters from A-Z is being encoded to numbers using the following mapping way: Beyond that, now the encoded string can also contai
阅读全文
posted @ 2017-08-03 13:07
Grandyang
阅读(8268)
推荐(1)
摘要:
In LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or mo
阅读全文
posted @ 2017-07-31 10:05
Grandyang
阅读(7754)
推荐(0)
摘要:
Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Input: 3 / \ 9 20 / \ 15 7 Outp
阅读全文
posted @ 2017-07-30 15:08
Grandyang
阅读(5420)
推荐(0)
摘要:
Given the running logs of n functions that are executed in a nonpreemptive single threaded CPU, find the exclusive time of these functions. Each funct
阅读全文
posted @ 2017-07-27 14:42
Grandyang
阅读(9107)
推荐(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 @ 2017-07-23 14:01
Grandyang
阅读(11474)
推荐(0)
摘要:
In combinatorial mathematics, a derangement is a permutation of the elements of a set, such that no element appears in its original position. There's
阅读全文
posted @ 2017-07-20 14:05
Grandyang
阅读(4555)
推荐(0)
摘要:
You have k lists of sorted integers in ascending order. Find the smallest range that includes at least one number from each of the k lists. We define
阅读全文
posted @ 2017-07-18 13:26
Grandyang
阅读(9490)
推荐(2)
摘要:
Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Example 2: 这道题让我们求一个数是否
阅读全文
posted @ 2017-07-16 14:43
Grandyang
阅读(8023)
推荐(2)
摘要:
Your task is to design the basic function of Excel and implement the function of sum formula. Specifically, you need to implement the following functi
阅读全文
posted @ 2017-07-14 14:42
Grandyang
阅读(5940)
推荐(0)
摘要:
Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one cha
阅读全文
posted @ 2017-07-10 06:53
Grandyang
阅读(8853)
推荐(1)
摘要:
Given n processes, each process has a unique PID (process id) and its PPID (parent process id). Each process only has one parent process, but may have
阅读全文
posted @ 2017-07-10 06:48
Grandyang
阅读(8665)
推荐(1)
摘要:
There are n different online courses numbered from 1 to n. Each course has some duration(course length) tand closed on dth day. A course should be tak
阅读全文
posted @ 2017-07-06 14:44
Grandyang
阅读(8043)
推荐(2)
摘要:
Given two integers n and k, find how many different arrays consist of numbers from 1 to n such that there are exactly k inverse pairs. We define an in
阅读全文
posted @ 2017-07-03 15:33
Grandyang
阅读(6536)
推荐(1)
摘要:
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
阅读全文
posted @ 2017-06-30 14:43
Grandyang
阅读(33658)
推荐(2)
摘要:
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
阅读全文
posted @ 2017-06-27 14:25
Grandyang
阅读(6693)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-25 05:27
Grandyang
阅读(4831)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-24 14:33
Grandyang
阅读(6224)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-23 15:35
Grandyang
阅读(4409)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-21 12:18
Grandyang
阅读(11786)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-20 13:02
Grandyang
阅读(9964)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-18 07:02
Grandyang
阅读(11197)
推荐(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 @ 2017-06-16 13:14
Grandyang
阅读(4937)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-15 11:13
Grandyang
阅读(4104)
推荐(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 @ 2017-06-14 11:35
Grandyang
阅读(5302)
推荐(1)
摘要:
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
阅读全文
posted @ 2017-06-13 11:01
Grandyang
阅读(5449)
推荐(0)
摘要:
这篇小结主要是参考这篇帖子从头到尾彻底理解KMP,不得不佩服原作者,写的真是太详尽了,让博主产生了一种读学术论文的错觉。后来发现原作者是写书的,不由得更加敬佩了。博主不才,尝试着简化一些原帖子的内容,希望能更通俗易懂一些。博主的帖子一贯秉持通俗易懂的风格,使得非CS专业的人士也能读懂,至少博主自己是
阅读全文
posted @ 2017-06-12 13:08
Grandyang
阅读(27594)
推荐(6)
摘要:
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
阅读全文
posted @ 2017-06-11 03:55
Grandyang
阅读(8822)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-10 14:19
Grandyang
阅读(4676)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-09 23:42
Grandyang
阅读(4159)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-07 23:14
Grandyang
阅读(5552)
推荐(0)
摘要:
Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final
阅读全文
posted @ 2017-06-06 23:30
Grandyang
阅读(4228)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-05 12:32
Grandyang
阅读(14177)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-02 12:45
Grandyang
阅读(6436)
推荐(0)
摘要:
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
阅读全文
posted @ 2017-06-01 11:14
Grandyang
阅读(7464)
推荐(0)
摘要:
在3D Slicer中,当我们导入.mha/.mhd等格式的volume文件后,那么我们就可以在Axial, Sagittal, Coronal三个方向来观察我们的MRI或者CT的图像了。3D Slicer界面提供了很多交互的功能,比如正上方就有一个滑动条slider,可以用来滑动切片观察,如果我们
阅读全文
posted @ 2017-05-31 08:09
Grandyang
阅读(1249)
推荐(0)
摘要:
There's a tree, a squirrel, and several nuts. Positions are represented by the cells in a 2D grid. Your goal is to find the minimal distance for the s
阅读全文
posted @ 2017-05-30 10:52
Grandyang
阅读(3449)
推荐(0)
摘要:
LeetCode wants to give one of its best employees the option to travel among N cities to collect algorithm problems. But all work and no play makes Jac
阅读全文
posted @ 2017-05-29 23:58
Grandyang
阅读(9344)
推荐(0)
摘要:
Given an integer n, find the closest integer (not including itself), which is a palindrome. The 'closest' is defined as absolute difference minimized
阅读全文
posted @ 2017-05-28 11:30
Grandyang
阅读(8300)
推荐(0)