【Sword Finger Offer】Total Collection

Preface

The task objectives of algorithms and algorithmic questions can be divided into four types: "addition, deletion, modification, and investigation".

Data structures include: arrays, strings, heaps, stacks, queues, linked lists, trees, collections, and so on.

Therefore, on different data structures such as arrays, strings, heaps, stacks, queues, linked lists, trees, collections, etc., perform any (or more) tasks such as "addition, deletion, modification, and check", and they only need to be arranged and combined. After a while, a large number of algorithm problems (Sword Finger Offer, LeetCode) have been formed. When solving these problems, the predecessors also gradually summarized and formed some methods for different data structures and performing different tasks (such as: fast and slow needle-linked list / search, binary search-array / search, ten sort-array / modify).

Therefore, when solving the problems of Jianzhi offer and LeetCode, it is often a test of our understanding of the algorithms and data structures. Even the "add, delete, modify, and check" operation performed in a specific data structure should have a relatively fixed algorithm that can be used. For example, to perform a search task in an ordered array , we will immediately think of binary search . Although these experiences are not necessarily a hundred-shot, but they are still very practical.



Topic index

Although the questions on the offer of Jianzhi and Likou are not the same, it is recommended that both sides should be brushed.

My index structure is:

Data structure 1:
|____ Task goal-topic 1
|____ Task goal-topic 2
|____…
|____ Special algorithm:
|____ |____ Task goal-topic n
|____ |____ Task goal-topic n+1
|____ |____ …
Data structure 2:
|____ Task goal-topic 1
|____ Task goal-topic 2
|____…
|____ Special algorithm:
|____ |____ Task goal-topic n
|____ |____ Task goal-topic n+1
|____ | ____
……


============ Number ============

Check- [Sword Finger offer] 43. The number of times 1 appears in an integer from 1 to n

Check- [Sword refers to offer] 44. A certain digit in the number sequence

Check- [Sword refers to offer] 49. Ugly number

Check- [Sword refers to offer] 60. The number of n dice

Check- [Sword refers to offer] 62. The last remaining number in the circle

Check- [Sword refers to offer] 64. Seek 1+2+…+n

Divide and conquer:

        Increase- [Sword refers to offer] 16. The integer power of the value

Bit operation:

        Check- [Sword refers to offer] 15. The number of 1s in binary

        Increase- [Sword refers to offer] 65. No need to add, subtract, multiply and divide for addition

how are you:

        Check- [Sword refers to offer] 14.1. Cut the rope

        Check- [Sword refers to offer] 14.2. Cut the rope II

Dynamic programming:

        Check- [Sword refers to offer] 46. Translate numbers into strings



============ Array ============

Check- [Sword refers to offer] 03. Repeated numbers in the array

Check- [Sword refers to offer] 04. Search in a two-dimensional array

Check- [Sword refers to offer] 11. Rotate the smallest number of the array

Check- [Sword refers to offer] 29. Print matrix clockwise

Check- [Sword refers to offer] 39. Numbers that appear more than half of the time in the array

Check- [Sword refers to offer] 40. The smallest number of k

Change - . [45] offer an array prove safety arranged smallest number

Check- [Sword refers to offer] 59. The maximum value of the sliding window

Check- [Sword refers to offer] 61. Straight in playing cards

Increase- [Sword refers to offer] 66. Build a product array

Dynamic programming:

        Check- [Sword refers to offer] 10.1 Fibonacci sequence

        Check- [Sword refers to offer] 10.2 The problem of frog jumping

        Check- [Sword refers to offer] 10.3 Rectangular coverage

        Check- [Sword refers to offer] 10.4 Abnormal jump

        Check- [Sword refers to offer] 42. Maximum sum of consecutive sub-arrays

        Check- [Sword refers to offer] 47. The greatest value of gifts

dichotomy:

        Check- [Sword refers to offer] 11. Rotate the smallest number of the array

        Check- [Sword refers to offer] 53. The number of times the number appears in the sorted array

        Check- [Sword refers to offer] 53.2 The missing numbers in 0~n-1

Backtracking search/DFS/BFS:

        Check- [Sword refers to offer] 12. The path in the matrix

        Check- [Sword refers to offer] 13. The robot's range of motion

Sort:

        Change - . [21] offer prove safety adjusted so that the array sequentially in front of even-odd

        Check- [Sword refers to offer] 51. Reversed pairs in the array

Bit operation:

        Check- [Sword refers to offer] 56. Number of occurrences of numbers in the array

        Check- [Sword refers to offer] 56.2 Number of occurrences of numbers in the array

Double pointer:

        Check- [Sword refers to offer] 57. The sum is the two numbers of s

        Check- [Sword refers to offer] 57.2 and two numbers with s

how are you:

        Check- [Sword refers to offer] 63. The maximum profit of stocks



============ String ============

Change - [05] to prove safety offer to replace spaces.

Check- [Sword refers to offer] 17. Print from 1 to the largest n digits

Check- [Sword refers to offer] 20. A string representing a numeric value

Change - . [37] offer prove safety binary serialization

Check- [Sword refers to offer] 50. The first character that appears only once

Change - [58] to prove safety offer Flip word order.

Change - [58.2] to prove safety offer string left rotation

Change - . [67] offer prove safety string into an integer

Dynamic programming:

        Check- [Sword refers to offer] 19. Regular expression matching

Backward search:

        Check- [Sword refers to offer] 38. String arrangement

Double pointer:

        Check- [Sword refers to offer] 48. The longest substring without repeated characters



============ Linked list ============

Check- [Sword refers to offer] 06. Print the linked list from end to beginning

Change - [24] to prove safety offer reverse a linked list.

Change - . [25] wins the offer to merge two sorted lists

Modification- [Sword refers to offer] 35. Copy of complex linked list

Check- [Sword refers to offer] 52. The first common node of two linked lists

Double pointer:

        Delete- [Sword refers to offer] 18. Delete the node of the linked list

        Delete- [Sword refers to offer] 18.2 Delete duplicate nodes in the linked list

        Check- [Sword refers to offer] 22. The kth node from the bottom in the linked list



============ Tree ============

Increase- [Sword refers to offer] 07. Rebuild the binary tree

Check- [Sword refers to offer] 08. The next node of the binary tree

Check- [Sword refers to offer] 26. The substructure of the tree

Change - . [27] offer binary prove safety mirror

Check- [Sword refers to offer] 28. Symmetrical binary tree

Check- [Sword refers to offer] 32.1 Print binary tree from top to bottom

Check- [Sword refers to offer] 32.2 Print binary tree from top to bottom 2

Check- [Sword refers to offer] 32.3 Print binary tree from top to bottom 3 / Print binary tree in zigzag order

Check- [Sword refers to offer] 34. The path whose neutralization is a certain value in the binary tree

Change - . [37] offer prove safety binary serialization

Check- [Sword refers to offer] 55. The depth of the binary tree

Check- [Sword refers to offer] 68.2 The nearest common ancestor of the binary tree

Binary Search Tree (BST):

        Check- [Sword refers to offer] 33. Post-order traversal sequence of binary search tree

        Change - . [36] to prove safety offer binary search trees and doubly-linked list

        Check- [Sword refers to offer] 54. The k-th largest node of the binary search tree

        Check- [Sword refers to offer] 68. The nearest common ancestor of the binary search tree

Binary balanced tree (AVL):

        Check- [Sword refers to offer] 55.2 Balanced Binary Tree



============ Queue stack ============

Increase- [Sword refers to offer] 09. Use two stacks to implement queues

Increase- [Sword refers to offer] 30. Stack containing min function

Check- [Sword refers to offer] 31. Stack push and pop sequence

Check- [Sword refers to offer] 41. The median in the data stream

Increase- [Sword refers to offer] 59.2 The maximum value of the queue

Guess you like

Origin blog.csdn.net/fisherish/article/details/114746817