- 博客(222)
- 收藏
- 关注
原创 #1 A + B Problem
题目描述:Write a function that add two numbers A and B. You should not use + or any arithmetic operators. NoticeThere is no need to read data from standard input stream. Both paramete
2016-08-30 13:24:43 323
原创 #3 Digit Counts
题目描述:Count the number of k's between 0 and n. k can be 0 - 9.Have you met this question in a real interview? YesExampleif n = 12, k = 1 in[0, 1, 2, 3, 4, 5, 6, 7, 8,
2016-08-30 13:23:01 337
原创 #5 Kth Largest Element
题目描述:Find K-th largest element in an array. NoticeYou can swap elements in the arrayHave you met this question in a real interview? YesExampleIn array [9,
2016-08-30 13:20:17 310
原创 #6 Merge Two Sorted Arrays
题目描述:Merge two given sorted integer array A and B into a new sorted integer array.Have you met this question in a real interview? YesExampleA=[1,2,3,4]B=[2,4,5,6]re
2016-08-30 13:18:27 319
原创 #12 Min Stack
题目描述: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) cost. Noticemin operation w
2016-08-30 13:13:15 302
原创 #14 First Position of Target
题目描述:For a given sorted array (ascending order) and a target number, find the first index of this number in O(log n) time complexity.If the target number does not exist in the array, retur
2016-08-30 13:11:47 241
原创 #16 Permutations II
题目描述:Given a list of numbers with duplicate number in it. Find all uniquepermutations.Have you met this question in a real interview? YesExampleFor numbers [1,2,2] the
2016-08-30 13:09:52 199
原创 #15 Permutations
题目描述:Given a list of numbers, return all possible permutations. NoticeYou can assume that there is no duplicate numbers in the list.Have you met this question in a real int
2016-08-30 13:07:18 191
原创 #29 Interleaving String
题目描述:Given three strings: s1, s2, s3, determine whether s3 is formed by the interleaving of s1 and s2.Have you met this question in a real interview? YesExampleFor s1 =
2016-08-30 13:01:46 192
原创 #30 Insert Interval
题目描述: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 order and non-overlapping (merge intervals if necessar
2016-08-29 12:31:50 428
原创 #31 Partition Array
题目描述:Given an array nums of integers and an int k, partition the array (i.e move the elements in "nums") such that:All elements k are moved to the leftAll elements >= k are moved to th
2016-08-29 11:21:23 449
原创 #32 Minimum Window Substring
题目描述:Given a string source and a string target, find the minimum window in source which will contain all the characters in target. NoticeIf there is no such window in source that cov
2016-08-29 11:06:25 397
原创 #34 N-Queens II
题目描述:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.Have you met this question in a real interview? Yes
2016-08-29 10:09:56 376
原创 #33 N-Queens
题目描述:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-quee
2016-08-29 09:55:26 431
原创 #40 Implement Queue by Two Stacks
题目描述:As the title described, you should only use two stacks to implement a queue's actions.The queue should support push(element), pop() and top()where pop is pop the first(a.k.a front) el
2016-08-29 04:19:37 375
原创 #39 Recover Rotated Sorted Array
题目描述:Given a rotated sorted array, recover it to sorted array in-place.Have you met this question in a real interview? YesClarificationWhat is rotated array?For exa
2016-08-29 04:08:27 404
原创 #42 Maximum Subarray II
题目描述:Given an array of integers, find two non-overlapping subarrays which have the largest sum.The number in each subarray should be contiguous.Return the largest sum. NoticeThe
2016-08-29 03:11:50 436
原创 #41 Maximum Subarray
题目描述:Given an array of integers, find a contiguous subarray which has the largest sum. NoticeThe subarray should contain at least one number.Have you met this question in a
2016-08-29 03:03:15 386
原创 #44 Minimum Subarray
题目描述:Given an array of integers, find the subarray with smallest sum.Return the sum of the subarray. NoticeThe subarray should contain one integer at least.Have you met t
2016-08-29 02:55:53 373
原创 明天打算讲讲的题目
Two pointers:1. Two Sum2. Two Sum II3. 3 Sum4. Triangle Count5. Longest Substring without repeat characters6. Container with most waterDynamic programming1. Unique Paths2. Hous
2016-08-28 12:20:51 563
原创 #48 Majority Number III
题目描述:Given an array of integers and a number k, the majority number is the number that occurs more than 1/k of the size of the array.Find it. NoticeThere is only one majority num
2016-08-28 12:03:53 456
原创 #47 Majority Number II
题目描述:Given an array of integers, the majority number is the number that occurs more than 1/3 of the size of the array.Find it. NoticeThere is only one majority number in the arra
2016-08-28 09:59:05 316
原创 #46 Majority Number
题目描述:Given an array of integers, the majority number is the number that occurs more than half of the size of the array. Find it.Have you met this question in a real interview? Yes
2016-08-28 09:46:50 359
原创 #45 Maximum Subarray Difference
题目描述:Given an array with integers.Find two non-overlapping subarrays A and B, which|SUM(A) - SUM(B)| is the largest.Return the largest difference. NoticeThe subarray should con
2016-08-28 09:24:02 484
原创 #50 Product of Array Exclude Itself
题目描述:Given an integers array A.Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate BWITHOUT divide operation.Have you met this question in a real interview? Yes
2016-08-28 08:35:41 346
原创 #51 Previous Permutation
题目描述:Given a list of integers, which denote a permutation.Find the previous permutation in ascending order. NoticeThe list may contains duplicate integers.Have you met th
2016-08-28 08:22:24 518
原创 #52 Next Permutation
题目描述:Given a list of integers, which denote a permutation.Find the next permutation in ascending order. NoticeThe list may contains duplicate integers.Have you met this q
2016-08-28 08:15:11 354
原创 #58 4Sum
题目描述:Given an array S of n integers, are there elements a, b, c, andd in S such that a + b + c + d = target?Find all unique quadruplets in the array which gives the sum of target. No
2016-08-28 07:54:26 340
原创 #59 3Sum Closest
题目描述:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. NoticeYou may assume that
2016-08-28 07:44:14 365
原创 #57 3Sum
题目描述:Given an array S of n integers, are there elements a, b, c in Ssuch that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. NoticeElements in a
2016-08-28 07:30:30 288
原创 #55 Compare Strings
题目描述:Compare two strings A and B, determine whether A contains all of the characters in B.The characters in string A and B are all Upper Case letters. NoticeThe characters of B in
2016-08-28 06:55:01 365
原创 #64 Merge Sorted Array
题目描述:Given two sorted integer arrays A and B, merge B into A as one sorted array. NoticeYou may assume that A has enough space (size that is greater or equal to m + n) to hold additi
2016-08-28 06:44:37 387
原创 #66 Binary Tree Preorder Traversal
题目描述:Given a binary tree, return the preorder traversal of its nodes' values.Have you met this question in a real interview? YesExampleGiven: 1 / \ 2 3 / \
2016-08-28 06:36:48 277
原创 #67 Binary Tree Inorder Traversal
题目描述:Given a binary tree, return the inorder traversal of its nodes' values.Have you met this question in a real interview? YesExampleGiven binary tree {1,#,2,3},
2016-08-28 06:35:17 329
原创 #68 Binary Tree Postorder Traversal
题目描述:Given a binary tree, return the postorder traversal of its nodes' values.Have you met this question in a real interview? YesExampleGiven binary tree {1,#,2,3},
2016-08-28 06:32:20 289
原创 #69 Binary Tree Level Order Traversal
题目描述:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).Have you met this question in a real interview? Yes
2016-08-28 06:07:40 314
原创 #70 Binary Tree Level Order Traversal II
题目描述:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).Have you met this question in a re
2016-08-28 06:04:25 339
原创 #71 Binary Tree Zigzag Level Order Traversal
题目描述: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 alternate between).Have you m
2016-08-28 06:00:09 283
原创 #72 Construct Binary Tree from Inorder and Postorder Traversal
题目描述:Given inorder and postorder traversal of a tree, construct the binary tree. NoticeYou may assume that duplicates do not exist in the tree.Have you met this question in
2016-08-28 05:50:43 307
原创 #73 Construct Binary Tree from Preorder and Inorder Traversal
题目描述:Given preorder and inorder traversal of a tree, construct the binary tree. NoticeYou may assume that duplicates do not exist in the tree.Have you met this question in
2016-08-28 05:38:58 311
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人