This July, I will have been working for 3 years! I remember in the summer of 2017, I took off my academic gown and bid farewell to my entire student life. When I found my first formal job, I had been declared an official office worker! That vigorous era is also an era of youth. Now the aftertaste, very long.

Forgive me for a moment, but let’s get down to business. Do you want to know why I joined Bytedance after meeting with Alibaba 9 times and Tencent 5 times? Look officer, please continue to look down.

25 interviews with big companies

I believe that every graduate of software development dreams of entering a first-line big factory like BAT. You all want to enter, of course, I am no exception. We are all in the same boat!

Let’s start with me. I don’t like compliments but I’m a little proud of them. Double non a graduation, although there is no such thing as how fierce but also go, don’t say read grind I really don’t like to read, read grind every day to back English words don’t you feel bored? I prefer logical things, because in this way in the big factory interview algorithm questions basically answer right.

For me, I got into programming relatively early. When I was in senior one, because my brother brought me a book on SELF-learning C language, I began to indulge in the sea of programming and fell flat after a fall. Up to now THAT book I have not thrown away, now when I have time will have a look, but now it seems that there are too few knowledge points, suitable for beginners to learn. By the way, it’s called ** C Primer Plus **, amway.

Because the high school three years love programming, so I after the college entrance examination for the volunteer can only be computer this direction, others say that college life is rich and colorful, I also believe the high school teacher’s nonsense, said what high school three years do not play, good study until the university casually you play, the teacher does not take the tube of you. So that I still don’t have a girlfriend, really pissed me off…

During the four years in college, I learned Java, android and C++ by myself. Later, I had a certain understanding of the popular GO language and AI. However, I started to develop APP because of the words of my college teacher, who said: In the future, Android programmers must be especially popular, listen to the old man’s words into the pit is three years.

Although it is also very good now, in the word energy saving to 34K after tax, but I still feel that programmers need is not the market industry, the need is strength and technology, as long as you have hard strength, no matter how the market, where the company will accept you. Isn’t extrapolation a good example?                                  

9 face Ali, 5 face Tencent heart course

Ali, Tencent and Byte have always been my goals. In fact, BEFORE graduation, I did not find the job I wanted, but found a small Internet company to do Android development (of course, IT was only after interviewing Tencent and Ali that I realized my own weakness).

But we can’t give up, not once and a second time, not twice and countless times. The least I can do is go into their R&D department and see how good their brains are at getting into a factory like that?

So, I began my three years of interviewing big factories;

For three years, I was stuck with countless interview questions that frustrated me and made me

The best advantage of me is that I can summarize in failure. I will write down the questions I can’t find in the interview, and then find the answers online after the interview, and record them in my own study notes.

Things like Android audio and video, **UI threads, view distribution reverse constraint methods, Future and MicroTask execution order, Java object locking and class locking, producer consumer (non-blocking) ** I’ll take note. This paved the way for me to successfully join Bytedance.

Ali’s 9 interviews

One side (2017 Enrollment)

  1. What are the four characteristics of the database, the isolation level of the database?
  2. What is the difference between HTTP and HTTPS?
  3. What are the three paradigms in database design?
  4. What about reverse linked lists?
  5. What is the difference between static proxy and dynamic proxy?
  6. What kinds of work queues do thread pools have?
  7. Can two processes require both write and read at the same time? How do I prevent process synchronization?
  8. What is ANR and how can you avoid it?
  9. How does APP performance stability work?
  10. What are your biggest feelings about memory optimization?
  11. How is the Kotlin feature different from Java?
  12. React Native? Let’s talk about the principle.

Second Interview (Autumn recruitment in 2017)

  1. How do I find out if the current thread is the main thread
  2. How do I detect if a function is stalling
  3. Commonly used symmetric encryption algorithm, what is the same
  4. View distributes the method of reverse restriction

I remember the interviewer was quite serious, which made me a little nervous and I hung up. Here’s a reminder that no matter what the interviewer asks you when you go into an interview, don’t panic.

Three Sides (2018 Spring Recruitment)

  1. Dart is passed by value or by reference
  2. The relationship between widgets and Elements and RenderObjects
  3. The root node of the widget
  4. The relationship between mixin extends Implement
  5. JVM memory model
  6. Future and MicroTask execution order
  7. await for
  8. The dart in.. The use of the

Four Faces (Spring Recruitment in April 2018)

  1. Future and MicroTask execution order
  2. The dart in.. What is the
  3. Await for use
  4. How is the startup mode of singleInstance assigned if the stack name is not specified
  5. The difference between ‘wait’ and ‘sleep
  6. What JVM threads are private
  7. How is the dynamic proxy method initialized

Five Faces (Autumn recruitment in October 2018)

  1. Brief introduction to the project
  2. Know which data structures
  3. Know which sorting algorithms
  4. Heap sort
  5. LinkedList and ArrayList; A HashMap expansion ConcurrentHashMap
  6. TCP and UDP: differences and application scenarios
  7. HTTP is TCP or UDP
  8. Differences between HTTP and HTTPS
  9. JVM memory model (where Static methods are located)
  10. Activity lifecycle, Activity start mode, Handler source code
  11. Rotate the array

Six Faces (March 2019 Spring Recruitment)

  1. The difference between final, finally and Finalize
  2. Inheritance of an abstract class’s member variables from its member methods
  3. A union is a union all
  4. MySQL index implementation
  5. B+ tree lookup time complexity, data structure
  6. What happened when you typed the url into your browser and hit Enter
  7. Three-way handshake
  8. HTTPS encryption process
  9. Principles of Symmetric and Asymmetric Encryption (RSA, AES)
  10. Single case of DCL torn by hand
  11. What other design patterns do you know

Seven faces (Spring Recruitment in April 2019)

  1. How is the dynamic proxy method initialized
  2. Cglib dynamic proxy
  3. What happens when three threads wait to wake up
  4. In the end, who is holding the activity? The handler leaks memory.
  5. Handler sendMessage and Postdelay differences
  6. The difference between an ArrayList and a HashMap
  7. Almost repetitive and vague

Eight faces (Autumn recruitment in September 2019)

  1. Stringbuilder is different from StringBuffer
  2. Lock is different from syncrognized, which applies to different scenarios.
  3. Realize the producer, the consumer
  4. Handler principle, how to implement delay.
  5. An activity starts the life cycle of another activity.
  6. Reverse a linked list
  7. Merge sort
  8. Quick sort

Nine Faces (Spring Recruitment in May 2020)

  1. Abstract classes and interfaces.
  2. Talk about the loading mechanism of classes.
  3. JVM memory reclamation mechanism, then you know which memory reclamation algorithm. The algorithm that the main one uses.
  4. The difference between abstract classes and interfaces.
  5. What startup modes does the Activity have
  6. The Fragment lifecycle is different from that of an Activity. (This answer is a bit confusing, can only say roughly the same thing)
  7. Explain the difference between threads and services.
  8. Explain event distribution mechanism, the view of a onFilterTouchEventForSecurity or what, the little brother is a unique method in the view, do you understand? (English level is not good enough, did not hear what is the method, say not clear.)
  9. How to encapsulate the recharge module
  10. The handler mechanism is explained.
  11. Template method to explain (head whiz, can’t remember)
  12. How to ensure application security and what to do.
  13. I understand the principle of reinforcement.

Tencent 5 aspects of the classics

One side

  • Mmap + Native log optimization?

It describes two performance problems of traditional log printing, one is repeatedly operating the file descriptor table, one is repeatedly entering the kernel state, and then describes the principle and mechanism of MMAP.

  • What’s the difference between broadcast and EventBus?

The implementation principle of EventBus is based on reflection, and it manages two tables, and the correlation between the code is not very easy to maintain. EventBus does not support cross-process communication. I said the source code I looked at was not supported and the interviewer said ok.

  • What common design patterns do you know?

I started to talk about a lot of things, including the decoration design mode, which was interrupted by the interviewer. Please tell me more about the decoration design mode.

  • What is cross-process communication?

Pipes, signals, semaphores, files, local sockets, shared memory, Binder drivers

  • Binder drivers?

From the Java layer just like accessing the local interface, the client is based on BinderProxy server based on IBinder object, and from the native layer the client is based on BpBinder to ICPThreadState to binder driver, The server side wakes up IPCThreadSate to BbBinder by binder driver. Then I covered virtual memory, physical memory, and memory mapping. The principles of cross-process communication are kernel-based. When I talked about binder_open, binder_mmap, and binder_ioctl, I was interrupted by the interviewer in case I went on too long.

  • How to pass large memory data across processes?

Binder is definitely not an option because the maximum memory size is only 1m-8K and can be in the form of binders plus anonymous shared memory, such as transferring large bitmaps across processes that require the underlying ashmem mechanism to be turned on.

  • So how does ConcurrentHashMap work? What’s the initial size?

Is thread-safe, implementation principle is the use of piecewise lock, the initial size is 16, must be a power of 2.

  • Startup optimization how to optimize?

I mentioned the key optimization of Application, but was interrupted by the interviewer, who said that you should stop talking about the things that everyone can think of. What I want to hear is whether you can do some optimization from the perspective of the system. I mentioned that the optimization of package size can optimize the startup speed, and the optimization of DEX subcontracting can optimize the startup speed. Can refer to the latest Huawei ark compiler and so on.

  • How do you implement rxPay and rxLogin?

Generally, we need to listen onActivityResult method when integrating third-party login and third-party payment SDK. I added transparent Activity by referring to the implementation scheme of RxPermission.

  • Kotlin + Fullter

Second interview

  1. How can static inner classes be thread-safe?
  2. Basic implementation principle of synchronized, ReentrantLock fair lock and unfair lock.
  3. How can the main thread wait for all threads to complete and then execute a particular task? Principle and source code read?
  4. Customizing the general process of view, what to pay attention to how to optimize, click events and long press time are respectively how to achieve?
  5. How does the four startup modes work in source code analysis?
  6. How did you optimize the bindService process?
  7. What design patterns did you use in your development? Tell me exactly what happened. Why do you use method factory? What about the other two?
  8. RxJava in the process of using some unfriendly error general how to resolve? How to solve the problem of memory leak? Have you ever encountered the problem of system service memory leak?
  9. You use okhttp? Have you done any network optimization? Such as weak network environment.
  10. I’ll give you a number of ones, like 1000011 how many ones are there?
  11. Do you understand? What’s the worst that can happen? How do you optimize if you have a lot of duplicate data?

On three sides

  • What is the underlying implementation of handler?

That simple? NativePollOnce handles delayed messages. In 6.0 or above, ePoll is used to monitor file descriptors. Then he asked why he used this method. What are its advantages over poll and SELECT? How does it listen have you seen how it works inside? It feels bad anyway.

  • Tell me about some logging optimization you did?

Taking the first round of interviews a step further, you write the current size at the end of each file. Have you ever thought about what would happen if the file was destroyed? How to deal with this abnormal situation? Encryption and compression are also asked. Binder driver: Memory mapping with Binder driver: Memory mapping with Binder driver: Memory mapping with Binder driver: Memory mapping with Binder driver: Memory mapping with Binder driver: Memory mapping with Binder driver: Memory mapping with Binder driver: Memory mapping with Binder driver Let me just write it down.

  • What optimizations have you made in the company?

Memory optimization, startup optimization, network optimization, packet volume optimization, specifically about packet volume optimization. I mentioned that package volume optimization not only optimizes the package size, too large package size from the moment of installation, our application may be slow, because PMS will copy, decompress and parse our APK installation file, optimize our dex and so on, too large package size will affect our startup speed. Why does obfuscating resources reduce package size? What was it like when you optimized it and how much was it reduced?

  • Some of the most difficult problems encountered during development?

Do you know how to fix class? How do you fix resources? If we register other attributes in the androidmanifest.xml of the plugin, what should we do about the resources?

All around

  1. Talk about your project first

Remote database to transfer the picture to app end, we then converted the picture into Base64 stored in the database, and then transmitted to app end, APP parse Base64 to obtain bitmap, directly display and then the interviewer crazy diss why to transfer the picture into Base64 and then pass (the second side also diss this, Ask if you can directly upload the picture address)

  1. Let’s talk about the framework of HTTP connections
  2. Retrofit principle
  3. What is dynamic proxy
  4. The custom view
  5. Inherit a viewGroup
  6. The activity life cycle
  7. Understanding the Handler mechanism

Five surface

  1. Java Exception Classification
  2. What is a compile-time exception
  3. What are the methods of object
  4. Why can a virtual machine make a class file recognizable to the machine
  5. What other formats do the client and server communicate in addition to JSON

I mentioned XML,hashmap, but I don’t seem to be very satisfied with it. Later I checked the data and found protobuf

  1. How does looper’s while loop determine scheduling in the source code, for example when MQ is empty?
  2. Dispatching events

Bytedance interview questions

One side

  1. The Jvm virtual machine
  2. MessageQueue will block the UI thread
  3. Object and class locks
  4. Zigzag print tree
  5. I can’t remember anything else, but I was so impressed by the second interview

Second interview

  1. Dart is passed by value or by reference.
  2. The relationship between widgets and Elements and RenderObjects
  3. The root node of the widget
  4. The relationship between mixin extends Implement
  5. JVM memory model
  6. Future and MicroTask execution order
  7. The dart in the… The use of the
  8. await for

On three sides

  1. Linux Network Model
  2. B + tree
  3. Blocking queue
  4. Differences between Redis and MongoDB. A few conceptual comparisons, and the underlying implementation.
  5. Algorithm: MergeksortedList, how about time complexity?
  6. What happens if a HashMap keeps putting elements? How about hashcode all the same? How about equals all the same?

I have compiled all the interview questions and answers into PDF, which also provides a guarantee for me to join Bytedance. If you need to interview recently, you need to refer to the interview questions(To be collected here)PDF data

                  

speech

This blog is almost over. Finally, I hope all my friends can have a good end-result, find a well-paid job and get their own satisfactory offer.

Work together towards dachang, mutual encouragement! If you like, you can take out your little hand and give it a thumbs-up.