-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoding-test-2_result.txt
101 lines (60 loc) · 2.39 KB
/
coding-test-2_result.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Test 1: find the missing number in the array.
The integer array is 3, 7, 1, 2, 8, 4, 5
The missing integer is 6
The integer array is sorted: 1, 2, 3, 4, 5, 7, 8
The missing integer is 6
Test 2: determine if the sum of two integers is equal to the given value.
The integer array is 5, 7, 1, 2, 8, 4, 3
The list of two numbers added to 10 is [7, 3] [2, 8]
Test 3: given a dictionary of words and a large input string. You have to find out whether the input string can be completely segmented into the words of a given dictionary.
The dictionary words are: "apple" "pear" "pie"
The string "applepie" can be segmented
The string "applepeer" can not be segmented
Test 4: given a sorted array of integers, return the low and high index of the given key. You must return -1 if the indexes are not found. The array length can be in the millions with many duplicates.
The integer array is 1, 2, 5, 5, 5, 5, 5, 5, 5, 5, 20
For value 5, the low index is 2 and high index is 9
Test 5: find k largest(or smallest) elements in an array.
The integer array is 1, 23, 12, 9, 30, 2, 50
The largest 3 values are :23 -> 30 -> 50
Test 6: rotate array by k elements
The integer array is 1, 2, 3, 4, 5, 6, 7
After rotating by 2, the integer array is 3, 4, 5, 6, 7, 1, 2
Test 7: rotate matrix 90" degree to right.
3 x 3 matrix:
1 2 3
4 5 6
7 8 9
After rotating matrix 90" degree to right:
7 4 1
8 5 2
9 6 3
4 x 4 matrix:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
After rotating matrix 90" degree to right:
13 9 5 1
14 10 6 2
15 11 7 3
16 12 8 4
Test 8: merge two lists
first list is: 1, 2, 5, 6
second list is: 2, 3, 4, 7
merge list is: 1, 2, 3, 4, 5, 6, 7
The original string is "ixxaayaeiouye"
After moving vowels is "xxyy"
Most efficient in line removing...
The original string is "ixxaayaeiouye"
After moving vowels is "xxyy"
Test 10: find k elements added up to max value
3, 1, -3, -4, 2, 4, 5
2 max elements: 4, 5
3 max elements: 3, 4, 5
1 max elements: 5
6 max elements: 3, 1, -3, 2, 4, 5
Test 10: matrix 3 x 3 and 3 colors has 20010 combination
Test 10: matrix 4 x 2 and 3 colors has 4007 combination
Test 10: matrix 2 x 2 and 2 colors has 18 combination
d c b a
b d c a