The latest finishing at the end of the year: Alibaba, Tencent, Byte, Huawei, Baidu and other major Android posts sharing!

origin

Many people squeeze their heads, and the fundamental reason for wanting to enter a large factory is that large factories are really different from small companies. I graduated from Shuangfei undergraduate in 15 years. After graduation, I have been doing Android related development work. I have experienced two startups in 18 years. One has worked in less than half a year and the boss ran away, and the other worked until the beginning of 2018. , Closed down because of improper operation (I wondered if I went to which company to go to which one had to close down).

In a small company, it is common to develop several apps at the same time, and the company's code and project management are very irregular, and some ancestral codes can make you feel a little confused. The combination of many factors has strengthened my determination to go to the big factory, whether it is to improve technical ability, gilding, or a testimony of the ability mentioned in the opening paragraph, in May of this year, I resolutely chose to speak naked, and started me The road to Bendachang.

Until the end of June, surface finished NetEase to fight a lot of pieces Youku mushroom Street , the result is cool (the heart is still very empty, so go first to some of the small-scale manufacturers to start). The overall feeling is that the interviewer feels like asking, but I’m stuck in my throat and I can’t tell. When I asked about some low-level, source code , my mind was blank. An interviewer even asked me, "You How did you get the previous 16k?". The preparation was still too inadequate, and I suddenly realized that I started to reduce the frequency of interviews in July and began to review, from the basic java to the underlying source code, what should be written back, what should be written, and recorded after each interview The interviewer’s questions, go back to review and extend, and practice to learn.

Settled

The effort pays off. After more than two months of study and promotion and interview "practice", taking advantage of the "golden nine silver ten" shareholder spirit, I got the byte offer in mid-September. In addition to my own efforts, there may be more Part of the reason is that Byte has been expanding recruitment recently (manual dog head), which gave me the opportunity to "take advantage of the void". The fixed salary is 25k, there is free afternoon tea every day, and there are unlimited snacks for self-collection. The fare is reimbursed after 21:00. I got the "fortunate" of 996 in the programmer's birth year (996+1024=2020).

This face-to-face sharing article has not been written until now. One reason is that not long after I joined the company, I naturally showed my gratitude to the “good fortune” and I couldn’t spare time to share it. Another reason is that I am not sure whether my sharing is valuable or useful for reference. I still feel that I came in as a kind of "lucky person". After all, none of the big factories interviewed before got an offer. of. But maybe this is the legendary "the harder you work, the luckier it is"!

The study notes reviewed before include interview questions from major companies. In order to facilitate their own review and systematic study, they are summarized as follows:

One, Java basic related

1.1 Data structure and algorithm

1.1.1 What are the commonly used data structures?
1.1.2 Array
(1) How to find the missing number in an integer array from 1 to 100?
(2) How to find the duplicate number in a given integer array?) (
( Xiaomi) (3) How to find the maximum and minimum values ​​in an unsorted integer array? (byte beating)
(4) How to delete multiple copies from a given array in Java?
(5) Add large numbers (today headlines) )

1.1.3 Linked list
(1) What about the first query and the second to last query? (This is different. The first one is directly given to the head node, and the last one needs to be queried from the first one, and two steps are taken) (Tencent)
(2) The underlying principle of arrayList (didi)
(3) How to find the median value of a single linked list in one traversal? (Ping An)
(4) How to prove whether a given linked list contains cycles? How to find the head node of the cycle? (Youku)
(5) Two singly linked lists with crosses, Find the intersection point (Huawei)
(6) How to get the length of the singly linked list? (360)
(7) How to reverse the singly linked list without using recursion? (Xiaomi/Meituan)
(8) How to judge that the linked list has loops? (Didi)
1.1.4 Queue & Stack
(1) How to use the stack to realize the function of the queue? (Guangzhou Lychee FM)
(2) Two stacks to achieve a queue (Mushroom Street)
(3) Two queues to achieve a stack (Tencent)
(4) Compare queues and stacks, and their bottom implementation (Tencent)
1.1.5 Binary tree
(1) How to perform a pre-order traversal in a given binary tree? (Baidu)
(2) How to implement a post-order traversal algorithm? (Baidu)
(3) How to perform a binary search in a given array? (Suning)
(4 ) It is known that the pre-order traversal is {1,2,4,7,3,5,6,8}, and the middle-order traversal is {4,7,2,1,5,3,8,6}. Its binary tree What's it like? (58)
(5) Input two binary trees A and B, and judge whether B is a substructure of A. (Iqiyi)
(6) Please implement two functions for serializing binary trees and deserializing binary trees. (YY)
(7) What is the difference between a balanced binary tree and a red-black tree? (Byte beating)
(8) What is a balanced binary tree and what are its characteristics (Meituan)
(9) B-tree, B+tree
1.1.6 HashMap
(1) What is the underlying principle of HashMap? Is it thread safe? (Baidu (Meituan)
(2) How is put implemented in HashMap? (Didi)
(3) When do I need to expand the hashMap, and how is the expansion resize() implemented?
(4) What is Ha Hope collision? How to solve it? (Didi. Meituan)
(5) The difference between HashMap and HashTable (Xiaomi)
(6) When does HashMap need to be expanded, and how is the expansion resize() achieved? (Didi)
(7 ) ) Principle of hashmap concurrenthashmap (Meituan)
(8) The difference between arraylist and hashmap, why is the number fast? (byte beating)
1.1.7 Figure
(1). Rotate the output matrix
(2). Given a matrix int matrixA[m ][n], each row and each column are in increasing order, and an algorithm is implemented to find an element in the matrix. (索狗)

1.1.8 What are the sorting algorithms?
(1) Top-k sorting, heap sorting, bitmap method) (
Meituan)
( 2) Handwriting of bubble sorting (Huajie Aimi) (3) Handwriting of heap sorting algorithm (Huajie Amy)
(4) Ellipse There are two race tracks in the shape field, which can provide two horse races at the same time. After the two horses race, you can know which horse is running fast, but there is no timing tool. Question, how to use the optimal algorithm (least number of matches) to know the fastest three horses among the 10 horses (Ali)
(5) Input an integer unordered array and sort the heap (Ali)
(6) How to use Quick sort algorithm sorts integer arrays ([CVTE)
1.1.9 Search algorithm
(1) Binary search algorithm for ordered arrays (Baidu)
1.1.10 String
(1) Given a string, please find out whether it contains The length of the longest substring of repeated characters. (Byte beating)
(2) Given a string s, find the longest palindrome substring in s. You can assume that the maximum length of s is 1000.
1.1.11 Please write down the time complexity of the following algorithms,
bubble sorting, insertion sorting, heap sorting, binary tree sorting,
1.1.12 other algorithms
(1) What is the difference between commonly used symmetric encryption algorithms? (Byte jitter)
(2) How to find out if there is a combination of two numbers that is the target in an unordered (with negative numbers) array, twoSum(); (byte)

1.2 Java basics
(1) Under what circumstances will stack memory overflow occur?
(2) What would you write if you were asked to write a piece of stack overflow code? How big is a stack, and why? Does each thread have a stack of this size? (Meituan)
(3) What is a complete GC process in the JVM, and how do objects promote to the old age?
(4) Introduce the GC recovery mechanism and generational recovery strategy.
(5) There are several reference relationships in Java, what is the difference between them?
(6) What are the GC collection algorithms? What are their characteristics?
(7) How to judge whether an object is recycled, what GC algorithms are there, and what GC algorithm is the most used by actual virtual machines
(Meituan ) (8) Jvm memory structure.
a. Describe the JVM memory model. (Oriental headlines)
(9) The difference between JVM DVM ART (360)
(10) Describe the GC mechanism. Will the Class be recycled? How to recycle unused Class? (Dongfang Toutiao)
(11) The difference between StackOverFlow and OOM? When did they happen, what is stored in the JVM stack, and what is stored in the heap? ( Meituan )
(12) The difference between the Java virtual machine and the Dalvik virtual machine?
(13) Please describe the process of new object.
(14) Will Java objects be allocated on the stack?
(15) What is the difference between String, Stringbuffer and StringBuilder? (Eastern headlines)
a.String StringBuffer StringBuilder's efficiency in string manipulation; here we mainly examine how String is created in memory. (Byte beating)
(16) Why is String immutable? (Byte beating) a
. Why is String designed to be final?
(17) The difference between final, finally, and finalize.
(18) The difference between abstract classes and interfaces.
(19) The difference between overloading and rewriting (JD.com)
(20) What is passing by value and passing by reference, and is Java passing by value or by reference?
(21) String s = new String(""); How many objects have been created?
(22) The difference between equals and == in java.
(23) try-catch-finally, there is return in try, is finally executed?
(24) The difference between Execption and Error.
(25) The difference between Static class and non static class.
(26) What is the difference between PathClassLoader and DexClassLoader?
(27) What is the parental delegation mechanism, and why is it necessary?
(28) Describe the JVM class loading process.
(29) What is a dynamic agent? How to achieve?
(30) How to initialize the dynamic proxy method? (Byte bounce)
(31) CGLIB dynamic proxy (byte bounce)
(32) Talk about the application scenarios of reflection, which frameworks and principles?
(33) The characteristics, advantages and disadvantages of Java generics, what's the matter with generic erasure?
(34) Whether List can be converted to List.
(35) The difference between generic super and extends.
a. Statement 2: Java's generics, the difference between <? super T> and <? extends T>.
(36). Why is IO a time-consuming operation?

1.3 Concurrent programming

(1) If there is only one cpu, single-core, multi-thread is still useful? (
Meituan ) (2) What is the difference between the sychronied modification method and the static method? What is visibility?
(3) What are the types of locks?
(4) The principle of CAS lock-free programming. (Byte beating)
(5) The realization principle of ReentrantLock.
(6) Principle of AQS (Xiaomi Jingdong)
(7) Principle of Synchronized and the difference with ReentrantLock. (360)
(8) What optimizations has Synchronized made after JDK1.8 (JD)
(9) The difference and scope of Synchronized static and non-static locks (Xiaomi)
(10) What does the volatile keyword do? (What is instruction rearrangement) (Byte beating)
(11) Can volatile ensure thread safety? What is the role in DCL?
(12) What is the difference between volatile and synchronize? (Xiaomi Jingdong Station B)
(13) How about using different objects for two threads? (Byte beating)
(14) What is a daemon thread? How do you exit a thread?
(15) The difference between sleep, wait and yield, how does the waiting thread wake it up? (Dongfang Toutiao, Byte Beat)
(16) Is sleep interruptible? (Xiaomi)
(17) Realizing non-blocking producer consumer (byte beating)
(18) How to open a thread, what are the problems with opening a large number of threads, and how to optimize? (Meituan)
(19) Thread life cycle.
(20) What is ThreadLocal?
(21) The principle of AyncTask.
(22) Are the tasks in AsyncTask serial or parallel?
(23) The principle of thread pool management.
(24) The relevant parameters of the thread pool, what types of thread pools are there, how to schedule thread pool tasks, is the task queue just a first-in first-out queue, what should I do if tasks have priority? Do you know priority inversion? (Meituan)
(25) There are three threads T1, T2, T3, how to ensure that they are executed in order?
(26) What are the ways to operate multithreading in Android?
(27) How to obtain whether the current thread is the main thread (byte beating)
(28) What is HandlerThread?
(29) How to communicate between threads?
(30) RxJava thread switching principle, what are the differences between RxJava1 and RxJava2?

1.4 Network programming
(1) Describe the process and meaning of TCP three-way handshake and four-time wave.
a. TCP's three-way handshake process? Why is the three-way handshake used? Is it possible to use the two-way handshake?
b. Why is the three-way handshake not twice, once, five times and six times (Meituan)
(2) What is the difference between TCP and UDP? (Tencent)
(3) What is the relationship between Http and Https?
(4) The process of SSL handshake.
(5) What is the difference between Http post and get request?
(6) What happened when I entered a URL into the browser? (Meituan)

2. Android system

(1) What is the life cycle of Acitvity?
a. In the life cycle of Acitvity, how to destroy an Activity? (美团)
(2) The four startup modes of Activity, and the issues that need attention in development, such as the call of onNewIntent();
a. The start mode of Activity, the difference (
Meituan ) b. If singleInstance does not specify the stack name, how is it allocated? (Byte jumping)
(3) Intent display jump and implicit jump, how to use? (Meituan)
(4) Activity A jumps to B, B jumps to C, A can't jump to C directly, how does A send messages to C? (美团)
(5) How does Activity save its state?
(6) Please describe the startup process of Activity, starting from clicking the icon. (Station B)
a. How does the APP start?
b. Process analysis of starting an Activity
(7) What is the life cycle of Service?
a. Service two life cycles and their differences
(8) Under what circumstances would you use Service?
(9) The difference between startServer and bindServier? (Meituan)
(10) The difference between Service and Thread?
(11) The difference between IntentService and Service?
(12) How to customize ContentProvider and what is the usage scenario?
(13) The difference between the static registration and dynamic registration of BroadcastReciver?
(14) Classification and working principle of broadcasting
(15) Can threads be opened in onReceive? What are the problems?
(16) What is orderly broadcasting?
(17) What is the difference between Application, Activity and Service context? Can you start an activity, dialog?
(18) Fragment life cycle? (Meituan)
(19) Why doesn't the Fragment constructor let you pass parameters? (Station B)
(20) The difference between Fragment add and replace, which affects the life cycle of Fragment (Meituan)

Three, View System

(1) View drawing process and custom View attention points. (Dongfang Toutiao, Meituan )
Every UI control in Android is integrated from View, and then these Views have the same drawing process, which must go through measure, layout and draw.
The drawing process of view is in the window adding process, ViewRootImpl The setView method of the class started
(2) Can the width and height be measured in onResume
(3) What is the process of the event distribution mechanism? (Dongfang Toutiao)
(How to solve the *** conflict? (Dongfang Toutiao)
(5) How to distribute the reverse restriction of View? (byte beating)
(6). Customize Behavior, NestScroll, NestChild. (Dongfang Toutiao)
(7 ) ). View.inflater process and asynchronous inflater (Dongfang Toutiao)
(8) Why is .inflater slower than custom View? (Dongfang
Toutiao ) (9). The execution order of onTouchListener onTouchEvent onClick. (58 Jingdong)
(10). How to intercept If the event onTouchEvent returns false, will onClick still be executed? (58 Jingdong)
(11). The distribution mechanism of the event, the advantages and disadvantages of the chain of responsibility model ( Meituan )
(12). The classification and difference of animation (car and home)
(13 ) ). What is the difference between attribute animation and ordinary animation? (Car and home)
(14). The difference between interpolator estimator (Car and home)
(15). Comparison of RecyclerView and ListView, caching strategy, advantages and disadvantages. (
Meituan ) (16) How does WebView do resource caching? (Byte Beat)
(17). Several ways and interception methods of WebView and JS interaction. (Byte beating)
(18). The difference between custom view and viewgroup
(19). View drawing principle
(20). The execution order of onTouch, onTouchEvent and onClick in View
(21). View sliding method
(22). The difference between invalidate() and postInvalicate()
(23). View drawing process is executed from which life cycle method of Activity
(24). The connection and difference between
Activity , Window and View (25). How to implement the Activity window Fast dimming
(26). Reasons for ListView stuck and optimization strategies
(27). Why is ViewHolder declared as a static inner class
(28). What are the animations in Android? Animations take up a lot of memory, how to optimize
(29). Custom View executes the invalidate() method, why sometimes it does not call back onDraw()
(30). The relationship between DecorView, ViewRootImpl and View, will ViewGroup.add() add a ViewrootImpl
(31). How to pass WindowManager Add Window (code implementation)?
(32). Why can't Dialog use Application Context?
(33). What is the token in WindowMangerService? What is the difference
(34). What is RecyclerView? how to use? How to return different items
(35). RecyclerView's recycling and reuse mechanism
(36). How to add more pull-to-refresh & pull-down loading mechanisms to ListView & RecyclerView
(37). How to refresh ListView & RecyclerView locally?
(38). What problems usually occur when a RecycleView is nested under ScrollView?
(39). When a ListView or a RecyclerView displays news data, the picture is misaligned. What are the possible reasons & how to solve it?
(40_.Requestlayout, onlayout, onDraw, DrawChild difference and connection
(41). How to optimize custom View
(42). Android property animation implementation principle, tween animation implementation principle

四、Android FrameWork

1. What are the ways of multi-process communication in Android?
a. Which process communication have you used? What is the principle? (Byte Bounce, Xiaomi)
2. Describe the principle of the Binder mechanism? (Eastern headlines)
3. What is the working process of the Binder thread pool? (Oriental headlines)
4. How does Handler perform thread communication, and what is the principle? (Oriental headlines)
5. If Handler has no message processing, is it blocking or non-blocking? (Byte Beat Xiaomi)
6.handler.post(Runnable) How is runnable executed? (
ByteDance , Xiaomi) 7. Handler's Callback and handleessage both exist, but will the callback return true and handleMessage will still be executed? (Byte Beat, Xiaomi)
8. What is the difference between Handler's sendMessage and postDelay? (Byte beating)
9. What is IdleHandler? How to use and what problems can it solve?
10. Why does Looper.loop not block the main thread?
a. Looper infinite loop why there is no ANR (Station B)
11. How to create Looper in child thread? (Byte Bounce, Xiaomi)
12. The relationship between Looper, handler, and threads. For example, how many Loopers can correspond to how many Handlers can a thread have? (ByteDance, Xiaomi)
13. How to update the UI, why can't the child thread update the UI? (美团)
14. The principle of ThreadLocal and how is it applied in Looper? (
ByteDance , Xiaomi) 15. What methods does Android store data?
16. SharedPreference principle, what is the difference between commit and apply? What kind of attention should be paid when using?
17. How to judge whether an APP is in the foreground or the background?
18. How to do app keep alive?
19. What is the size of a picture 100x100 in memory? (Byte beating)
20. Intent's principle and function, what types of parameters can be passed?
21. What if a large amount of data needs to be transferred between Activities?
22. Open multiple pages, how to achieve one-click exit?
23. How to monitor the life cycle of LiveData? (Station B)

Five, performance optimization topics

1. App stability optimization
2. App startup speed optimization
3.
App memory optimization 4. App drawing optimization
5. App slimming
6. Network optimization
7. App battery optimization
8. Android security optimization
9. Why is WebView slow to load?
10. How to optimize custom View
11. When will FC (Force Close) appear?
12. How to solve the performance problems caused by Java multithreading?
13. The realization principle of TraceView, analyze the source of data error.
14. Have you ever used SysTrace and understood the principle?
15.mmap + native log optimization?

Six, three-party source code understanding

1. Glide: loading, caching, LRU algorithm (how to design a big picture loading framework by yourself) (LRUCache principle)
2.
EventBus
3. LeakCanary
4. ARouter 5. Plug-in (the principle and genre of different plug-in mechanisms, advantages and disadvantages. Limitations (Performance )
6. Hot fix
7. RXJava (RxJava's thread switching principle)
8. Retrofit (What encapsulation does Retrofit do on OkHttp? How is the difference between dynamic proxy and static proxy implemented)
9. OkHttp

End of sentence

Some of the above questions are also some interview questions I found on the Internet during my review. I myself parsed these interview questions and summarized them into a document, which was not shown in the article due to space reasons. A good memory is not as good as a bad pen. Always brush the interview questions with a "I should know" mentality. After I have written an article in my mind, I feel that the answer will come up. However, I often get stuck when I really talk to the interviewer. Write each interview question again, and then do the extension. When you can write every interview question logically, there will be absolutely no problem during the interview. ![]The latest finishing at the end of the year: Alibaba, Tencent, Byte, Huawei, Baidu and other major Android posts sharing!

If you need this full version of the interview notes, you only need to support me in this article.

Quick start channel: (click here) to download! Full of sincerity! ! !

More information about the Android architecture can be obtained for free here.

It is not easy to organize. If you think my sharing is helpful to you, please give me a like and support it! In addition, I wish all the friends who are interviewing can get their ideal offer!

Guess you like

Origin blog.51cto.com/14786417/2591001