- 博客(222)
- 收藏
- 关注
原创 #1 A + B Problem
题目描述: Write a function that add two numbers A and B. You should not use + or any arithmetic operators. Notice There is no need to read data from standard input stream. Both paramete
2016-08-30 13:24:43
422
原创 #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? Yes Example if n = 12, k = 1 in [0, 1, 2, 3, 4, 5, 6, 7, 8,
2016-08-30 13:23:01
444
原创 #5 Kth Largest Element
题目描述: Find K-th largest element in an array. Notice You can swap elements in the array Have you met this question in a real interview? Yes Example In array [9,
2016-08-30 13:20:17
399
原创 #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? Yes Example A=[1,2,3,4] B=[2,4,5,6] re
2016-08-30 13:18:27
408
原创 #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. Notice min operation w
2016-08-30 13:13:15
364
原创 #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
323
原创 #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? Yes Example For numbers [1,2,2] the
2016-08-30 13:09:52
270
原创 #15 Permutations
题目描述: Given a list of numbers, return all possible permutations. Notice You 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
263
原创 #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? Yes Example For s1 =
2016-08-30 13:01:46
264
原创 #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
506
原创 #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
524
原创 #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. Notice If there is no such window in source that cov
2016-08-29 11:06:25
484
原创 #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
447
原创 #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
495
原创 #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
447
原创 #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? Yes Clarification What is rotated array? For exa
2016-08-29 04:08:27
493
原创 #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. Notice The
2016-08-29 03:11:50
521
原创 #41 Maximum Subarray
题目描述: Given an array of integers, find a contiguous subarray which has the largest sum. Notice The subarray should contain at least one number. Have you met this question in a
2016-08-29 03:03:15
456
原创 #44 Minimum Subarray
题目描述: Given an array of integers, find the subarray with smallest sum. Return the sum of the subarray. Notice The subarray should contain one integer at least. Have you met t
2016-08-29 02:55:53
439
原创 明天打算讲讲的题目
Two pointers: 1. Two Sum 2. Two Sum II 3. 3 Sum 4. Triangle Count 5. Longest Substring without repeat characters 6. Container with most water Dynamic programming 1. Unique Paths 2. Hous
2016-08-28 12:20:51
630
原创 #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. Notice There is only one majority num
2016-08-28 12:03:53
518
原创 #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. Notice There is only one majority number in the arra
2016-08-28 09:59:05
366
原创 #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
418
原创 #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. Notice The subarray should con
2016-08-28 09:24:02
552
原创 #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
400
原创 #51 Previous Permutation
题目描述: Given a list of integers, which denote a permutation. Find the previous permutation in ascending order. Notice The list may contains duplicate integers. Have you met th
2016-08-28 08:22:24
576
原创 #52 Next Permutation
题目描述: Given a list of integers, which denote a permutation. Find the next permutation in ascending order. Notice The list may contains duplicate integers. Have you met this q
2016-08-28 08:15:11
402
原创 #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
391
原创 #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. Notice You may assume that
2016-08-28 07:44:14
420
原创 #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. Notice Elements in a
2016-08-28 07:30:30
330
原创 #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. Notice The characters of B in
2016-08-28 06:55:01
420
原创 #64 Merge Sorted Array
题目描述: Given two sorted integer arrays A and B, merge B into A as one sorted array. Notice You 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
442
原创 #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? Yes Example Given: 1 / \ 2 3 / \
2016-08-28 06:36:48
315
原创 #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? Yes Example Given binary tree {1,#,2,3},
2016-08-28 06:35:17
374
原创 #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? Yes Example Given binary tree {1,#,2,3},
2016-08-28 06:32:20
331
原创 #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
378
原创 #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
382
原创 #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
324
原创 #72 Construct Binary Tree from Inorder and Postorder Traversal
题目描述: Given inorder and postorder traversal of a tree, construct the binary tree. Notice You may assume that duplicates do not exist in the tree. Have you met this question in
2016-08-28 05:50:43
348
原创 #73 Construct Binary Tree from Preorder and Inorder Traversal
题目描述: Given preorder and inorder traversal of a tree, construct the binary tree. Notice You may assume that duplicates do not exist in the tree. Have you met this question in
2016-08-28 05:38:58
364
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅