sword-x-offer
sword-x-offer copied to clipboard
66 classic and common interview problems from 《剑指offer》 with multiple-method-CPP solutions, and common data structure summary, etc
真正的希望必定存在于甘心赴死的绝望中
sword-x-offer
sword-x-offer not only contains 66 common && classic interview programming problems but also others like common data structure summary based in language CPP etc. Particularly, each problem has multiple solutions.
Content
-
Problem Set
1.1 Ordered List
1.2 Topic List
1.2.1 binary-search
1.2.2 linked-list
1.2.3 binary-tree
1.2.4 dynamic programming -
Data Structure(TODO)
2.1 binary-search
2.2 linked-list
2.3 string
2.4 tree
2.5 sort
2.6 graph -
Language CPP(TODO)
3.1 Style: Google C++ Style Guide
3.2 Common C/C++ questions
3.3 gcc five minute
3.4 basic cpp language
3.5 system design
3.6 Deep Learning questions - Project Based Learning
- License
- Acknowledge
1.Problem Set
1.1 Ordered List
id | problem | topic | difficulty | OJ link | similarity |
---|---|---|---|---|---|
01 | find-value-in-matrix | binary-search | ★★★ | nowcoder | |
02 | replace-space | string | ★★★ | nowcoder | |
03 | print-linked-list-from-tail | linked-list | ★★★ | nowcoder | |
04 | reconstruct-binary-tree | tree | ★★★★ | nowcoder | |
05 | stack-operation-based-two-queues | queue | ★★ | nowcoder | |
06 | min-num-in-reverse-array | array | ★★ | nowcoder | |
07 | fibonacci-sequence | loop/recursion,dp | ★★ | nowcoder | |
08 | jump-floor | loop/recursion,dp | ★★ | nowcoder | |
09 | jump-floor-II | loop/recursion | ★★ | nowcoder | |
10 | rectangle-cover | loop/recursion | ★★★ | nowcoder | |
11 | number-of-one-in-binary | bit-manipulation | ★★★ | nowcoder | |
12 | integer-power-of-number | ★★★ | nowcoder | ||
13 | reorder-array-as-odd-number-is-in-the-front | array | ★★★ | nowcoder | |
14 | countdown-k-node-in-linked-list | linked-list | ★★ | nowcoder | |
15 | reverse-linked-list | linked-list | ★★★ | nowcoder | |
16 | merge-two-sorted-linked-list | linked-list | ★★★ | nowcoder | |
17 | judge-the-substructure-of-a-binary-tree | tree | ★★★★ | nowcoder | |
18 | mirror-of-binary-tree | tree | ★★★★ | nowcoder | |
19 | print-matrix-clockwise | array | ★★★★ | nowcoder | |
20 | stack-contain-min-func | stack | ★★★ | nowcoder | |
21 | push-and-pop-sequence-of-stack | stack | ★★★★ | nowcoder | |
22 | print-binary-tree-from-top-to-bottom | tree | ★★★ | nowcoder | |
23 | postorder-traversal-of-binary-search-tree | tree | ★★★★ | nowcoder | |
24 | target-length-path-of-binary-tree | tree | ★★★★ | nowcoder | |
25 | replication-of-complex-linked-list | linked-list | ★★★★ | nowcoder | |
26 | convert-binary-search-tree-to-bi-directional-linked-list | tree,linked-list | ★★★★ | nowcoder | |
27 | string-permutation | string,math | ★★★★ | nowcoder | |
28 | the-number-occurs-more-than-half | array | ★★★ | nowcoder | |
29 | k-minimum-number | array,heap | ★★★★ | nowcoder | |
30 | the-largest-sum-of-consecutive-subarrays | greedy,dp | ★★★★ | nowcoder | |
31 | number-of-1-between-1-and-n | math | ★★★★ | nowcoder | |
32 | arrange-the-array-into-the-smallest-number | ★★★ | nowcoder | ||
33 | ugly-number | math | ★★ | nowcoder | |
34 | first-character-that-appears-only-once | array,hash-table | ★★ | nowcoder | |
35 | inverse-pairs-in-array | array,math | ★★★★★ | nowcoder | |
36 | find-first-common-node-in-two-linked-lists | linked-list | ★★★ | nowcoder | |
37 | number-of-occurrences-in-the-sorted-array | array,hash-table | ★★ | nowcoder | |
38 | depth-of-binary-tree | tree | ★★ | nowcoder | |
39 | judge-balanced-binary-tree | tree | ★★★★ | nowcoder | |
40 | find-num-appear-once-in-array | array,hash-table | ★★★★ | nowcoder | |
41 | sum-s-of-continuous-positive-sequence | ★★ | nowcoder | ||
42 | two-sum | ★★ | nowcoder | ||
43 | left-rotate-string | string | ★★★ | nowcoder | |
44 | reverse-words-in-sentence | string | ★★★★ | nowcoder | |
45 | is-poker-continuous | ★★★ | nowcoder | ||
46 | the-last-number-in-the-circle | math | ★★★★ | nowcoder | |
47 | sum-from-1-to-n | ★★ | nowcoder | ||
48 | sum-of-two-numbers | bit-manipulation | ★★★ | nowcoder | |
49 | str-to-int | string,array | ★★★★ | nowcoder | |
50 | duplicate-number-in-array | array,hash-table | ★★★ | nowcoder | |
51 | construct-multiply-triangle | array | ★★ | nowcoder | |
52 | regular-expression-match | string | ★★★★ | nowcoder | |
53 | numeric-string | string | ★★★★ | nowcoder | |
54 | first-appearing-once-in-str-stream | string | ★★ | nowcoder | |
55 | entry-of-loop-linked-list | linked-list | ★★★ | nowcoder | |
56 | delete-duplication-in-linked-list | linked-list | ★★★★ | nowcoder | |
57 | next-node-of-binary-tree | tree | ★★★★ | nowcoder | |
58 | is-symmetrical-binary-tree | tree | ★★★ | nowcoder | |
59 | print-binary-tree-layer-by-layer | tree | ★★★ | nowcoder | |
60 | print-binary-tree-layer-by-layer-II | tree | ★★★ | nowcoder | |
61 | serialize-binary-tree | tree | ★★★★ | nowcoder | |
62 | kth-node-of-binary-search-tree | tree | ★★★★ | nowcoder | |
63 | get-median-of-num-stream | tree | ★★★ | nowcoder | |
64 | max-in-sliding-window | stack/queue | ★★★ | nowcoder | |
65 | path-in-matrix | backtracking | ★★★★ | nowcoder | |
66 | range-of-robot | backtracking | ★★★★ | nowcoder |
1.2 Topic List
Binary Search
- 01-find-value-in-matrix
Linked List
- 03-print-linked-list-from-tail
- 14-countdown-k-node-in-linked-list
- 15-reverse-linked-list
- 16-merge-two-sorted-linked-list
- 25-replication-of-complex-linked-list
- 26-convert-binary-search-tree-to-bi-directional-linked-list
- 36-find-first-common-node-in-two-linked-lists
- 55-entry-of-loop-linked-list
- 56-delete-duplication-in-linked-list
Binary Tree
- 04-reconstruct-binary-tree
- 17-judge-the-substructure-of-a-binary-tree
- 18-mirror-of-binary-tree
- 22-print-binary-tree-from-top-to-bottom
- 23-postorder-traversal-of-binary-search-tree
- 24-target-length-path-of-binary-tree
- 26-convert-binary-search-tree-to-bi-directional-linked-list
- 38-depth-of-binary-tree
- 39-judge-balanced-binary-tree
- 57-next-node-of-binary-tree
- 58-is-symmetrical-binary-tree
- 59-print-binary-tree-layer-by-layer
- 60-print-binary-tree-layer-by-layer-II
- 61-serialize-binary-tree
- 62-kth-node-of-binary-search-tree
- 63-get-median-of-num-stream
Dynamic Programming
- 07-fibonacci-sequence
- 30-the-largest-sum-of-consecutive-subarrays
- 51-construct-multiply-triangle
- 52-regular-expression-match
2.Data Structure
- binary-search
- linked-list
- string
- tree
- sort
- graph
3.Language CPP
- Style: Google C++ Style Guide
- Common C/C++ questions-I
- Common C/C++ questions-II
- lexdene/gcc_five_minute: gcc五分钟系列
- basic cpp language: lang-cpp
- soulmachine/system-design: 系统设计面试题精选
- donnemartin/system-design-primer
5.License
Apache License 2.0.
6.Acknowledgement
Solutions in sword-x-offer are mainly from the forum of nowcoder and book 《剑指offer》. Particularly, I learned a lot from the forum of nowcoder.
Project-based-learning is from this repo., which is under MIT License.
Judge Script
#!bin/bash
while true;
do
./data
./std
./test
if diff std.out test.out;then
echo AC
else
echo WA
exit 0
fi
done