Home  >  Article  >  Backend Development  >  Freshly released Go interview questions (Baidu and MiHoYo)

Freshly released Go interview questions (Baidu and MiHoYo)

藏色散人
藏色散人forward
2021-09-25 16:38:569434browse

I recently interviewed for go technical positions at two companies, one at Baidu and the other at MiHoYo. The interview situation was not very optimistic. Now let me share the questions asked during the interview.

Both companies used online interviews. There was no recording at the time. Now I rely entirely on my own memories to review them.

baidu side

Baidu’s interview steps are divided into computer basics, go related, mysql related, redis related, linux related issues. There are also some divergent issues.

Basic related algorithms

  • Algorithms, including but not limited to red-black trees, binary trees, etc.
  • Data structures, including but not limited to linked lists, arrays, etc. Some issues related to
  • tcp, ip, such as three-way handshake, four-way wave, time_wait, etc.
  • Enter the address in the browser and describe the process in detail. (I feel like I’ll basically get asked this, hahaha).

As for this section, my answers were sparse. I didn’t answer any of the algorithms and data structures. The latter two were asked in interviews before, so I checked some and answered them fairly well. Can.

go related

  • GC, (required questions for GO), GCstwTiming, how to solve each stage.
  • gpm, (a required question for GO), this must be fully understood, how preemptive scheduling preempts, and how to schedule goroutine , the number of M and P.
  • How to elegantly implement a goroutine pool (this answer is sparse)
  • Talk about memory escape
  • Memory management (this answer is also sparse) Broken)

mysql related

  • mysql lock, lock granularity and lock algorithm (gap lock, record lock, temporary key lock), and Under what circumstances will the lock algorithm be used? The general meaning is that if it can be accurately matched, record locks will be used, otherwise it will degenerate into gap locks
  • mysql mvvc implementation principle.
  • mysql index, index creation timing, and creation rules.
  • Mysql sub-database and table rules, have you ever practiced them?
  • mysql index type and index data structure
  • mysql transaction characteristics, and isolation level.

redis

  • What are the data types of redis and let’s talk about the usage scenarios.
  • redis There should be two encoding methods for zset. Configured in the configuration file, the default 128 elements are ziplist (compression table), and if it is larger than 128, it is skiplist
  • Redis memory elimination Strategy
  • Redis persistence strategy
  • redis distributed lock
  • What are the redis distributed architectures
  • If there is a ranking list, use zset, based on Sort by points and time. The one with the highest points and the one with the closest time will be taken first. How to achieve this?

linux

  • What commands are you familiar with?
  • If the online traffic surges, all of it will be sent to one upstream. Yes, how to check.
  • How to find out the top 10 requested IPs in nginx access log

##Summary

After I finish the interview, I usually ask Interviewer, based on this interview, if you have any good suggestions or opinions on my technical skills, the interviewer's answer to me is: The computer foundation is relatively weak, but the business ability is very strong. This is also my current situation, haha, so I have been reading computer theory and operating systems taught by teachers from Harbin Institute of Technology recently. I hope my hard work can make up for my shortcomings.

米HoYoOne side

The MiHoYo interview is generally divided into four parts,

go is related, mysql is related , redis related, linux related.

go related

    I was confused by the first question. The code is as follows:
...m := make(map[int]int, 10)for i := 1; i<= 10; i++ {
    m[i] = i}for k, v := range(m) {
    go func() {
        fmt.Println("k ->", k, "v ->", v)
    }()}...
Ask what will happen, why, and how to solve it. Just don't use closures directly to use external variables, it can be solved by passing parameters.

  • Memory leak, under what circumstances the memory will be leaked.
  • The underlying implementation principle of channel (in fact, it means asking that buf is the data structure of a circular linked list)
  • defer, this must be answered carefully, when will defer modify the return value. The order of multiple defers.
  • The difference between make and new
  • What happens when the channel is closed and then the data is sent, and what happens when a closed channel is closed.
  • Is map thread-safe? Map expansion rules.
  • The difference between arrays and slices.
  • GC
  • GPM model
  • The difference between processes, threads and coroutines. (This is very important)

There are others I forgot.

redis

is almost like Baidu.

mysql

is almost the same as Baidu.

linux

Pretty much the same, so I asked how to check the id of the process based on the process name.

##Summary

According to the interview feedback, MiHoYo gave a poor Go foundation but strong business capabilities. Maybe this is the characteristic of outsourcing before.

MiHoYo's Second Side

MiHoYo's Second Side mainly asks questions about business and algorithm aspects, and it mainly consists of three parts.

    Microservice related, including registration and discovery of microservices, monitoring of microservices, current limiting of microservices, etc., and how to protect the process of microservices. My answer is supervisor, also I don’t know if that’s right.
  • The realization of specific business, the realization of redemption codes, how to batch generate hundreds of thousands or millions of redemption codes, (my answer is to use the snowflake algorithm to implement this), under high concurrency, how about one redemption code Guarantee that it can only be redeemed once by one person, and how a redemption code can be redeemed by multiple people. (It took me half an hour to answer this question. Because I have done related business before, I feel a little unsure)
  • Three algorithm questions.
    1. Write a method to solve: input 4 numbers, output an expected value through addition, subtraction, multiplication and division.
    2. Breadth-first algorithm: How to output the values ​​of each layer.
    3. Step problem, if you want to go up a step, you can go up one step at a time, or you can go up two steps at a time. Write a method to input the number of steps and output how many ways to go up.

Recommended: "golang tutorial"

The above is the detailed content of Freshly released Go interview questions (Baidu and MiHoYo). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete