Unknowingly, 2021 is coming, and the vigorous autumn recruitment is also perfect. I do not know how many small partners have become a stumbling block to attack big factories?
As it happens, I have spent some time in the last two days to sort out some algorithm questions in the interview process of major companies (Google+ Baidu +Alibaba+ byte +Tencent+ netease +360+ Pin-Xixi + Meituan + Xiaomi). If you are interested, why not test yourself?
A total of some algorithms in the nearly ten interview questions, and all of these can be in the < programmers to code the interview guidelines – optimal solution algorithms and data structures known IT subject > < algorithm brush topic LeetCode > < algorithm, version 4 > (below) to find the corresponding interpretation, and collect all in my folder daqo > < algorithm, poking me download, won the international access code: the Denver nuggets
Algorithmic shopping: Google+ Baidu +Alibaba+ byte +Tencent+ netease +360+ Pin-Xixi + Meituan
# 1: Alibaba[Search recommendation]
If n+1 numbers in [1,n] are in the array of length N, there must be at least one duplicate number
Two sides: probability problem: find the probability that a rope can be cut twice to form a triangle.
Three aspects: FM derivation, deepfm principle, graph embedding, asked about some previous projects.
Four sides of the intersection: what to look out for when the model goes live, what to do if the model service is overrequested, the difference between TensorFlow and Torch, how to reduce model complexity.
Second: Baidu
Native Business Promotion Department
- One side: Algorithm problem: fast sorting non-recursive, rotate the ordered array to find a value
- Second side: algorithm problem: a two-dimensional array, there are 0 and 1, connect all the adjacent 1 to find the final number of connected 1. Regular difference between L1 and L2, Softmax loss function
Recommend technical platform department
- One side: Algorithm: Bitmap
- Second side: algorithm: list deduplication, extension: delete all the duplicate values in the list
Number three: Google
Sad na, before always want to cast post Google, the result fell in such a small algorithm problem… Algorithm: design a circular ordered linked list to achieve the increase, delete, change and check four functions.
Fourth: bytes
Byte favorite algorithm…
Algorithm: the snake print binary tree algorithm: the number given [[1, 2], [3, 5], [8, 8], [15, 16], [32, 38]], strives for the interval
Given two ascending arrays A and B and length m and n, find the KTH largest number
Algorithm: Give array A, length n, array element values between [0, n-1], find whether there are duplicate elements
Algorithm: Left view of binary tree
Algorithm: coins of face value [1,3,4], input n, output the minimum number of coins composed of n and the coins composed
Algorithm: Given a positive integer n, ask how many binary search trees can be formed by 1-n
Number five: Tencent
Algorithm: Merge ordered linked lists
Algorithm: ordered integer array, given a number, from the array to find two numbers add up to it. Order n time
Algorithm: a string, assuming enough space, replace all Spaces with “%20”, requiring that no new space be created
Algorithm problem: say idea, 100 machines, each machine on 1 billion numbers, find inside the largest 100 numbers
Algorithm: Determine if a binary tree has a path and a path with a specified value (no temporary variables)
Algorithm: Multiply large numbers (type code directly, come back in 10 minutes to see the result)
Sixth: netease
OneTwoThree given 0~9 How do you restore a string like this if it’s completely out of order?
Given n positive integers, find ai and AJ such that the shape formed by (I,0) (I,ai) (j,0) is maximum
Maximum suborder and LeetCode 53
Number seven: 360 search
One side: Algorithm problem: matching word lists in a large number of texts
Second side: algorithm: string editing distance, the NTH ugly number, the longest common substring
Design a HashMap algorithm
If n+1 number is in [1,n], there must be at least one duplicate number
Eighth: fight xi Xi
One side, the algorithm: linked list quick sorting
The second face, intelligence questions: 100 balls, two people take the ball in turn, each time can only take 1-5, a first, for a winning scheme
Ninth: Meituan Beidou
One side asked the internship project, algorithm problem: rotate the ordered array to find a value
The second part also focuses on projects, algorithmic questions: GBDT splitting using O(N) complexity
Find the longest distance between inversions in an unordered array
Number 10: Xiaomi search
There are only 0 and 1 in an array. If you change 0 to 1, you can’t use the method of counting times.
Extension: what if there are 0,1,2?
Second side project, algorithm problem: undirected graph dijkstra algorithm implementation.
Algorithm shopping: programmer code interview guide -IT famous enterprise algorithm and data structure problem optimal solution
All relevant notes have been collected and sorted out, algorithm daqo: data structure and algorithm + Ali cloud 70+ algorithm questions 30 kinds of high frequency knowledge points + left process cloud – programmer code interview guide + algorithm brush LeetCode+ algorithm analysis – the fourth edition
Download: Nuggets
First: < Algorithm – 4th edition >
As a classic reference book in the field of algorithms, it provides a comprehensive introduction to the necessary knowledge of algorithms and data structures, with special emphasis on sorting, search, graph processing and string processing. Version 4 details 50 algorithms that every programmer should know and know, provides actual code, and the Java code implementation is modular in a programming style that readers can easily adapt
Second: programmer code interview guide -IT enterprise algorithm and data structure problem optimal solution
Zuo Chengyun’s “Programmer code Interview Guide -IT Enterprise Algorithm and Data Structure Problem Optimal Solution” contains nearly 200 real classic code interview questions (and each has a small star indicating difficulty level), divided into the following nine parts:
- Stack and Queue (10)
- 2. Linked List Problem (20)
- Three, binary tree problem (24)
- 4. Recursive and Dynamic Programming (17)
- 5. String Problems (23)
- Big Data and Spatial Limitations (6)
- 7. Bit Operation (6)
- 8. Arrays and Matrices (26)
- Ix. Other Issues (34)
Algorithms and Data Structures: Stack and Queue (10)
-
1. Design a stack with getMin function
-
2. A queue consisting of two stacks
-
3. How to reverse a stack using only recursive functions and stack operations
-
4. Dogs and cats
-
5. Use one stack to sort another stack.
-
6. Using a stack to solve the Hannotta Problem
-
7. Generate window Max array
-
8. Create array MaxTree (表 示 ★★★☆)
-
9. Find the size of the largest submatrix (calibration ★★★)
-
10. The maximum number minus the minimum number of subarrays whose value is less than or equal to num
IT Enterprise algorithms and data structure problem optimal solution: Linked list problem (20)
-
1. Print the common part of two ordered lists.
-
2. Delete the KTH node from singly and doubly linked lists.
-
3. Delete the middle node of the list and the node at a/ B.
-
4. Reverse one – way and two – way linked lists
-
5. Reverse partial one-way linked list
-
6. Joseph’s problem for circular singly linked lists
-
7. Determine whether a linked list is a palindrome.
-
8. Divide a one-way list into small left, equal middle, and large right values.
-
9. Duplicate linked lists with random Pointers
-
10. Two singly linked lists generate an additive List
-
11. A series of problems at the intersection of two singly linked lists (add ★★★★)
-
12. Reverse the order between each K nodes of a singly linked list
-
13. Delete unordered single-linked list with repeated values (* * * *)
-
14. Delete a node with a specified value from a single linked list.
-
15. Convert the search binary tree to a bidirectional linked list
-
16. Selection sorting of single linked lists
-
17. A weird way to delete nodes
-
18. Insert a new node into an ordered ring singly linked list
-
19. Merge two ordered singly linked lists
-
20. Recombine single-linked lists as left and right halves
The optimal solution to the problem of Binary Tree (24)
-
1. Implement pre-order, middle-order and post-order traversal of binary tree in recursive and non-recursive ways respectively (校★★★☆)
-
2. Print the boundary node of the binary tree
-
3. How to print a binary tree intuitively (wen★ ★☆)
-
4. Binary tree serialization and deserialization
-
5. Divine method for traversing binary tree (add ★★★★ ★)
-
6. Find the longest path length in the binary tree whose summation is the specified value.
-
7. Find the largest search binary tree in binary tree (wen★ ★☆)
-
8. Find the largest topology in the binary tree that meets the search conditions of the binary tree (校★★★☆)
-
9. Binary Tree Printing by Layer and ZigZag Printing (wei ★★☆)
-
10. Adjust two wrong nodes in search binary tree (original problem: ★★★★ ★)
-
11. Determine whether T1 tree contains all the topological structure of T2 tree (士★☆☆)
-
12. Determine whether t1 tree has the same topological structure as T2 tree (校★★★☆)
-
13. Determine whether a binary tree is a balanced binary tree.
-
14. Search binary tree reconstruction based on post-ordinal group
-
15. Determine whether a binary tree is a search binary tree or a complete binary tree.
-
16. Generating balanced Search binary trees from ordered Arrays (* * * *)
-
17. Find the successor of a node in a binary tree
-
18. Find the nearest common ancestor of two nodes in a binary tree
-
Tarjan algorithm and Parallel lookup Set to Solve the batch query problem of the nearest common ancestor between nodes in binary tree (校★★★☆)
-
20. The maximum Distance between nodes in a binary tree (wei ★★☆)
-
21. Binary tree Reconstruction based on the combination of pre-ordered, middle-ordered and post-ordinal groups
-
22. After ordinal group is generated from preordinal and middle ordinal group.
-
23. Counting and generating all the different binary trees (en.★ ★☆)
-
24. Count the number of nodes in a complete binary tree
Algorithms and Data Structure Problems: Recursive and Dynamic Programming (17)
-
1. Recursive and Dynamic Programming for Fibonacci Problems
-
2. Minimum path sum of matrix
-
3. The minimum amount of currency needed to change money
-
4. Number of ways to change money
-
5. Longest increasing subsequence (calibration ★★★☆)
-
6. Hannotta problem
-
7. The Longest Common Subsequence Problem (wei ★★☆)
-
8. Longest common substring problem (calibration ★★★ ★)
-
9. Minimum editing cost (proofreading ★★★)
-
10. Interleaved composition of strings (calibration ★★★ ★)
-
11. Dungeons and Dragons game problems (Lt. ★★☆)
-
12. Number of alphanumeric character strings converted into letter combinations
-
13. The number of components of the expression to obtain the desired result (grade ★★★)
-
14. A Line of card Game problem
-
15. Jump Game
-
16. The longest continuous sequence in an array
-
17. The queen of the Question (校★★★ ★)
IT Enterprise algorithms and Data structure questions: String questions (23)
-
1. Check whether two strings are anagrams of each other.
-
2. Sum of numeric substrings in string (* * * *)
-
3. Remove k consecutive zeros from the string (* * * *)
-
4. Check whether two strings are spins of each other.
-
5. Convert an integer string to an integer value
-
6. Replace successive occurrences of the specified string in the string.
-
7. String statistics String (s)
-
8. Determine if all characters in a character array occur only once.
-
9. Find a string in an ordered but empty array
-
10. String adjustment and replacement
-
11. Flip string (* * * *)
-
12. The minimum distance between two strings in an array
-
13. Add the minimum number of characters to make the whole string palindrome string (calibration ★★★☆)
-
14. The validity and maximum valid length of a parenthesis string
-
15. Formula string evaluation (calibration ★★★☆)
-
16. The number of binary strings that must be 1 to the left of 0
-
17. Concatenate all strings to produce the smallest dictionary order uppercase string (correction ★★★ ★)
-
18. Find the longest non-repeating character substring of a string
-
19. Find the new type of character to refer to
-
20. Minimum length of substring (calibration ★★★)
-
21. The minimum segmentation of palindromes (wei ★★★☆)
-
22. String matching problem (proofreading ★★★☆)
-
23. Implementation of dictionary Tree (Prefix Tree) (wei ★★☆)
Big Data and Space Constraints (6)
-
1. Understand the Bloom filter (wei ★★☆)
-
2. Use only 2 billion integers in 2 GB to find the most common number.
-
The number missing from the 340 million non-negative integers
-
4. Finding duplicate urls in 10 billion urls and top K search terms
-
The number that occurs twice and the median of all numbers in the 540 million non-negative integers
-
6. Basic principles of consistent Hashing Algorithm (wei ★★☆)
Programmer code Interview guide -IT Enterprise algorithm and data structure questions optimal solution: bit operations (6)
-
1. Exchange two integer values without additional variables
-
2. Find the greater of two numbers without using any comparative judgment.
-
3. Add, subtract, multiply and divide integers by bits without arithmetic
-
4. How many ones are there in the binary representation of integers?
-
5. Find an odd number in an array where all other numbers occur even times.
-
6. Find a number that occurs only once in an array where all other numbers occur k times
Algorithms and Data Structures: Array and Matrix Problems (26)
-
1. Rotary printing matrix
-
2. Rotate the square matrix 90 ° clockwise
-
3. “zigzag” print matrix
-
4. Find the smallest number of k in the unordered array (O(Nlogk) method, (O(N) method, ★★★★ ★)
-
5. The shortest subarray length to sort (* * * *)
-
Select * from array where N/K is greater than N/K.
-
7. Find a number in a matrix where the rows and columns are ordered.
-
8. The length of the longest integrable subarray
-
9. Do not repeat printing all tuples and triples in a sorted array whose sum is given.
-
10. The maximum array length in an unsorted positive array whose summation is a given value
-
11. A series of maximal array problems in unsorted arrays whose summation is a given value
-
12. The maximum array length in an unsorted array whose summation is less than or equal to the given value.
-
13. Calculate the small sum of arrays (calibration ★★★☆)
-
14. Sorting arrays of natural numbers
-
15. Odd indices are always odd or even indices are always even.
-
16. The problem of maximum Summation of subarrays
-
17. The Problem of maximum Summation of submatrices
-
18. Find a locally smallest location in the array.
-
19. Maximum Multiplicative product of array neutrons (wei ★★☆)
-
20. Print Top K of N arrays
-
21. The largest square size with all boundaries of 1.
-
22. Set of tired multipliers that do not include the value of this position
-
23. Array partition adjustment (* * * *)
-
24. Find the shortest path value (wei ★★☆)
-
25. Smallest positive integer not present in array
-
26. The maximum difference between contiguous numbers after sorting an array (en.★ ★☆)
Optimal Solutions to algorithms and Data Structures: Other Questions (34)
-
1. From 5 random to 7 random and its extension (original problem captain ★★★ ★★★ ★)
-
2. Find the greatest common divisor of two numbers in one line of code
-
3. Two questions about factorial (the original question is about ★★★ ★★★
-
4. Determine if a point is inside the rectangle.
-
5. Determine if a point is inside the triangle.
-
6. Origami Problem (Wei ★★☆)
-
7. Reservoir algorithm (wei ★★☆)
-
8. Design a hash table with setAll function
-
9. The absolute value of the difference between leftMax and rightMax
-
10. Design a cache structure that can be changed
-
11. Design RandomPool structure (w ★★☆)
-
12. Adjust the probability of occurrence of the number on the interval [0,x]
-
13. Change path array to statistics array (校★★★☆)
-
14. Minimum Uncomposible sum of positive arrays
-
15. A correspondence between strings and numbers (proofread ★★★☆)
-
16. The number of occurrences of 1 from 1 to n (proofreading ★★★☆)
-
17. Print M numbers from N numbers with medium probability
-
18. Determine if a number is a palindrome
-
19. Find the minimum value in an ordered rotation array
-
20. Finding a number in an ordered rotation array
-
21. English and Chinese expressions of numbers (school ★★★☆)
-
22. Divide the candy problem (school ★★★☆)
-
23. A Structure design for Message Receiving and Printing (wei ★★☆)
-
24. Design a heap structure without capacity expansion burden (add ★★★★)
-
25. Find the median of the data stream at any time (add ★★★★)
-
26. Find the upper median in two sorted arrays of equal length
-
27. Find the KTH smallest number in both sorted arrays (add ★★★★ ★)
-
28. The TOP K problem of the sum between two ordered arrays (wei ★★☆)
-
29. The number of occurrences of the TOP K problem (original problem captain ★★★ ★★★ ★★
-
30. Manacher algorithm (add ★★★★)
-
31. KMP algorithm (★★★★)
-
32. The problem of losing chess pieces (校★★★☆)
-
33. The Painter’s Problem (校★★★☆)
-
34. The location of the post office (校★★★☆)
< LeetCode>
< algorithm brush title LeetCode> should be the most familiar but, here is no longer too much introduction, brush brush brush brush brush…
The Over! That’s it for the algorithm, the key is more hands-on, brush brush up! Code hits!
< programmer code interview guide -IT famous enterprise algorithm and data structure problem optimal solution >< algorithm brush problem LeetCode>< algorithm – 4th edition > and so on are brush problem learning good gems, good things naturally want to share, that is – poke ME download, get code: nuggets