- 博客(15)
- 收藏
- 关注
原创 No. 47 - Search in a Rotation of an Array
参考:http://codercareer.blogspot.com/2013/03/no-47-search-in-rotation-of-array_31.html
2014-07-16 22:57:59 276
原创 Least Number after Deleting Digits
Problem: Please get the least number after deleting k digits from the input number. For example, if the input number is 24635, the least number is 23 after deleting 3 digits. 参考:http://codercaree
2014-07-15 08:51:04 289
原创 Longest Substring without Duplication
Problem: Given a string, please get the length of the longest substring which does not have duplicated characters. Supposing all characters in the string are in the range from ‘a’ to ‘z’. 妙处在于如何正确定
2014-07-15 02:38:40 318
原创 Numbers Appearing Once
Problem: In an array, all numbers appear three times except one which only appears only once. Please find the unique number. 参考:http://codercareer.blogspot.com/2013/12/no-50-numbers-appearing-once.
2014-07-15 02:37:01 461
原创 Next Number with Same Set of Digits
Problem: Reorder the digits of a number, in order to get the next number which is the least one that is greater than the input number. For example, the number 34724126 is the next number of 34722641
2014-07-14 04:25:34 441
原创 装配线调度问题
/* Copyleft: Ming Lin */ #include #include void print_line(int *l, int n) { int i; for (i = 0; i < n; i++) printf("line %d, station %d\n", l[i]+1, i+1); } int fastest_way(int s_entry[2], in
2014-07-12 23:18:18 439
原创 Maximal Product when Cutting Rope
Problem: Given a rope with length n, how to cut the rope into m parts with length n[0], n[1], ...,n[m-1], in order to get the maximal product of n[0]*n[1]* ... *n[m-1]? We have to cut once at least.
2014-07-12 14:28:22 406
原创 Longest Arithmetic Sequence - Question 3
/* Copyleft: Ming Lin */ #include #include #include struct element { int key; struct element *next; struct element *tail; }; struct hash { int size; struct element **head; int first; };
2014-07-12 08:32:42 435
原创 Longest Arithmetic Sequence - Question 1
Question 1: Given an array, please get the length of the longest arithmetic sequence. The element order in the arithmetic sequence should be same as the element order in the array. For example, in t
2014-07-12 05:57:24 419
原创 Three Increasing Elements in an Array
Problem: Given an array of integers A, please find three indexes i, j, k, such that ijk and A[i]j]k]. cd
2014-07-10 15:35:31 280
原创 Group of 1s in a Matrix
Problem: Given a matrix with 1s and 0s, please find the number of groups of 1s. A group is defined by horizontally or vertically adjacent 1s. For example, there are four groups of 1s in Figure 1 whi
2014-07-10 13:53:37 320
原创 Median in Stream
Question: How to get the median from a stream of numbers at any time? The median is middle value of numbers. If the count of numbers is even, the median is defined as the average value of the two nu
2014-07-07 14:21:30 228
原创 A Pair with the Maximal Difference
A Pair with the Maximal Difference Problem: A pair contains two numbers, and its second number is on the right side of the first one in an array. The difference of a pair is the minus result whil
2014-07-04 02:33:20 440
原创 Maximum Sum of All Sub-arrays
Question: A sub-array has one number of some continuous numbers. Given an integer array with positive numbers and negative numbers, get the maximum sum of all sub-arrays. Time complexity should be O(n
2014-07-03 02:30:57 402
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人