The two-year period has come. See Dragon King. Recently the next byte, the surface before read a lot of nuggets big man’s excellent article, the surface to feedback once, although I the content of the surface is really too simple, may be a fake, the reference significance is not big.

background

I graduated in 2018 and worked in an export e-commerce company. When I first came here, I planned to come out two years later. Although it was said that the epidemic environment was not good, I still resolutely resigned naked.

One is to fulfill that year’s appointment (there is a taste), the other is in the last company feel there is no room for improvement, epidemic reasons and out of all kinds of things.

I left office on July 16, and did homework and played games at home. Hr added me to my wechat account on the 30th byte, and I said wait for me to sort out the resume. I gave the resume on August 5th, evaluated it on the same day and arranged the interview on August 24th.

Tell me why you picked number 24. One is to look at the nuggets on the noodle, feel good, leave the preparation time, byte can be about 30 days, I think it is not too late, 17 days is always enough. Second, I didn’t have an interview for a long time, and I was going to find a company to find the feeling of the interview, but I was still nervous afterwards.

The following two aspects from the interview and interview preparation.

Face the

A 50 min

The main stack was Vue, and there was a project written by Reack + Mobx. The interviewer asks you to introduce yourself and then starts with the framework:

  1. What’s the difference between Vue and React?
  2. What is the difference between Mobx objects and Maps? Underlying implementation? B: I don’t know
  3. Do you use Hooks? (Said yes, and then went down
  4. How does Vue implement bidirectional binding?
  5. What are the disadvantages of defineProperty? Why use Proxy and what do you know about Proxy?
  6. Programming issues to achieve a publish and subscribe model (give the framework, let specific implementation
  7. How does Websocket set up a connection?
  8. What is your understanding of BFF? Why does Node support high concurrency? How does multithreading affect performance other than context switching?
  9. React-sticky placeholder elements cannot be updated synchronously
  10. Algorithm problem array K big element (quick row, I first said the idea and then asked the time complexity, and then write
  11. Manually control the fetchWithLimit of concurrent requests
  12. Do you have any questions for me?

Can remember these, in addition to programming algorithm other basic ask from the resume, reference significance is not big.

There was something wrong with the quicksort. The interviewer said you didn’t have to sort in place. I also explained to the interviewer that it was wrong, but the use case at that time was correct.

FetchWithLimit says a Promise. All, but the interviewer says it’s not the fastest implementation, so I’m not going to write it because of time, and I’m going to wait five minutes for the next round

The second interview 50 min

  1. Programming problems manually control concurrent requests fetchWithLimit as fast as possible
  2. Algorithm array to heavy, ES5 implementation, distinguish between numbers and strings
  3. Algorithm problem to determine whether a one-way linked list has a ring
  4. What are the difficulties of IM project?
  5. Why not use frames for rich text?
  6. How do I get the paste event? How to judge is pasted picture?
  7. How do you compress pictures?
  8. Why encapsulate Websocket? How does the heart beat?
  9. What is the difference between Koa and Express?
  10. Talk about CommenJS and ES6 modules.
  11. Tell me about your open source project. Why?
  12. What else do you want to talk about? Any other studies?
  13. Have you read Vue source code?
  14. What about http1.0, http1.1, http2.0, http3? Speak as much as you know
  15. Tell me about caching. How do I disable strong caching?
  16. Anything else you want to say?
  17. Do you have any questions for me?

The second surface to do three questions, programming questions with the same side, but in another way, I began to steal joy, directly a shuttle to write out the side, he looked and said this is not the fastest, can write the fastest, and explained, I said I try. The results write write card Lord, at that time did not think how to go to cycle execution (recursion), asked the train of thought on the first. Next two easy, and then the project.

In the second interview, the interviewer gave me a lot of freedom and let me play by myself all the time, such as: tell me about the project, what I can say, what I want to say in addition to the above. And every time I would go blank and I wouldn’t know what to say, and then he would smile and say, “Okay, I’ll ask you.”

Finally, I asked if there were any comments or suggestions for me. I said that I could see that I was a pragmatic person, but maybe I needed to strengthen my depth. More to the point. Hr made an appointment on 26th in the evening.

The three sides of 40 min

The first two were so easy that I panicked. I felt abandoned. But still want to prepare, the feeling is mainly programming and algorithm, so go to niuke collected a following algorithm programming problem brush brush, behind will share the next topic.

The third meeting was 5:00 p.m., the interviewer was a little serious, and I was also nervous. As a result, most of the time, we talked about non-technical things.

  1. Returns an array with two subscripts equal to the given number.
  2. How can I tell if HTTPS is tampered with?

Leetcode number one. I’m going to write it very quickly, and I’m going to ask you the time, and then I’m going to say what’s the sum of the three numbers, and how do I do that? Just talk about the idea. HTTPS is tampered with in the middle of how to identify, this does not know, first said first handshake, and then the data is symmetric encryption. How can this be changed? And then to say no decryption is sabotage. Let’s just say I don’t know. In fact, you can think about how to deal with their own.

Non-technical questions are all about what kind of person you are, whether you can do your job, what you want to do in the future, etc. Among them, I said the second interview of the interviewer’s evaluation, he said the depth of this also depends on the company’s project. After going to that I had said recent thinking, later he asked “are you is a man of perseverance, a lot of people say to do”, I said is more ideological change, feel this two years what also didn’t do, every day dozen game, may for the interview to see something before, now may be more of a professional attitude.

The other don’t say, anyway this period of time feel oneself really good dish, see the school recruit students of the face is much stronger than me, that my advantage in which? Maybe I only have a little project experience.

Finally put me on hold for 20 minutes. Next round.

HR面 40min

Within 20 minutes, I asked HR about the appointment and told them to use Zoom in the HR interview. HR will say a lot more. Three to five working days.

Interview preparation

Data structures and algorithms

I have never brushed the algorithm before, and I recommended the algorithm cheat sheet of Labuladong for the preparation I started after leaving the job. I talked about the solving framework of various types of questions. I have a methodology for everything, and I can brush the questions quickly by mastering the methods. I didn’t read all of them, I read some of them, moving rules, backtracking, sliding Windows, backpacks, stocks, and so on, which is the must-read series. At the beginning of the relatively slow, but slowly from the algorithm to see a face meng forced to see the algorithm to think about what is the problem.

“The beauty of Data structure and algorithm” (my link purchase will have cashback), vivid image, easy to understand, combined with the practical application, let me understand a lot of things that I did not understand before.

Here I list the questions I asked and the questions I collected. Most of them are easy, some of them are hard, and you can also see a lot of Offer references. If you have time, I recommend to finish the Offer references (I only brushed 37). By the end of three days I had done 123 – easy 58 medium 51 hard 14. The interview turned out to be so simple. However, I also feel that the algorithm is actually quite interesting, and I intend to stick to one problem every day.

Time complexity. I was asked several times in the interview about complexity.

String/array

    1. The sum of two Numbers
    1. The sum of three number
    1. Search rotation sort array
    1. The KTH largest element in the array
    1. The first unique character in a string
  • Offer 39. A number that occurs more than half the time in the array
  • The sword refers to Offer 50. The first character that appears only once
  • 45° print matrix, back print matrix

The list

    1. Circular linked list
    1. Palindrome list
  • Sword finger Offer 24. Reverse the linked list
  • 25. Merge two sorted lists
  • Sword refers to Offer 52. The first common node of two linked lists
  • Interview question 02.07. Linked lists intersect

The stack/queue

    1. Basic calculator
    1. Basic Calculator II
    1. Implement stacks with queues
  • Offer 09. Implement queues with two stacks

Binary tree

    1. Symmetric binary tree
    1. Balanced binary trees
    1. Path to the combined
    1. Sum of Paths II
    1. Flip the binary tree
    1. Merge binary trees
  • 28. Symmetric binary tree
  • Finger Offer 32-i. Print binary tree from top to bottom
  • Offer 55-i. Depth of binary tree
  • The first, middle and last order are known as binary reductive binary trees

Dynamic programming

    1. Climb the stairs
    1. Edit distance
    1. The best time to buy and sell stocks
    1. The best time to buy and sell stocks II
    1. The best time to buy and sell stocks III
  • 19. Regular expression matching

back

  • The sword refers to Offer 38. Arrangement of strings

Dp [n] indicates the interval in which the NTH digit is the last value. I don’t know if I’m doing this correctly.

/ * *

* Given a positive integer sequence A, we can compute an X value for each interval;

* The X value is defined as follows: for any interval, the X value is equal to the smallest number in the interval multiplied by the sum of all numbers in the interval;

* Now you need to find the interval of a with the highest X value;

* a = 3; Then the maximum range of X value is 6, 4, 5, X = 4 * (6+4+5) = 60;

 *

* Author: Jason Gan

* link: https://juejin.cn/post/6844904088337907720

* Source: Nuggets

* Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please indicate the source.

* /




function getMaxX (array{

  let n = array.length

  if (n === 0return 0

  let min = [array[0]]

  let dp = [array[0] * array[0]]

  let max = dp[0]

  for (let i = 1; i < n; i++) {

    let val = array[i]

    let preMin = min[i - 1]

    min[i] = Math.min(preMin, val)

    let one = dp[i - 1] * min[i] / preMin + val * min[i]

    let two = val * val

    if (one > two) {

      dp[i] = one

    } else {

      dp[i] = two

      min[i] = val

    }

    max = Math.max(max, dp[i])

  }

  return max

}



console.log(getMaxX([3.1.6.4.5.2])) / / 60

Copy the code

Programming problem

This is a good article that gives you 21 high-frequency handwritten JavaScript interview questions “once and for all.” Be sure to write your own, the above is not a problem, there is not necessarily one way to achieve, the interview may ask you if there are other methods, such as saving money, focus on the idea. FetchWithLimit is like implementing a function that allows a maximum of n tasks at the same time.

Other things to look at are handwritten promises, floating-point arithmetic, and multiplying large numbers.

Implement a promise asynchronous scheduler with concurrency limits, but the answer is problematic, the questions have changed.

/ * *

* JS implementation of an asynchronous scheduler with concurrent control, to ensure that there are at most two tasks moving at the same time, improve the following code

* /


class Scheduler {

  add (promiseCreator) { ... }

  / /...

}



const timeout = (time) = > new Promise(resolve= > setTimeout(resolve, time))



const scheduler = new Scheduler()



const addTask = (time, order) = > {

  scheduler.add((a)= > timeout(time)).then((a)= > console.log(order))

}



addTask(1000.1)

addTask(500.2)

addTask(300.3)

addTask(400.4)

Copy the code

My implementation:

class Scheduler {



  constructor (limit = 2) {

    this.limit = limit

    this.concurrent = 0

    this.stack = []

  }



  add (promiseCreator) {

    if (this.concurrent < this.limit) {

      this.concurrent++

      return promiseCreator().then((a)= > {

        this.concurrent--

        this.next()

      })

    } else {

      let resolve

      let p = new Promise(r= > {

        resolve = r

      })

      this.stack.push((a)= > {

        promiseCreator().then((a)= > {

          resolve()

          this.concurrent--

          this.next()

        })

      })

      return p

    }

  }



  next () {

    if (this.stack.length > 0 && this.concurrent < this.limit) {

      let p = this.stack.shift()

      this.concurrent++

      p()

    }

  }

}

Copy the code

Computer fundamentals, front-end fundamentals and so on

I don’t want to talk about that. A bunch of nuggets. I prepared a lot of them by myself. I may organize them by modules later.

Good article

  • Art meow 2 years of front end of the interview journey (bytes to beat, YY, tiger tooth, BIGO) | the nuggets technical essay
  • A self-inspection list of a [qualified] front end engineer
  • See a good front end test open source project

Also don’t “trust books”, such as this article on DOM, CSS, JS blocking, parsing render order


CSS does not block DOM parsing. Finally, I wrote my own Demo and found that console printing came first.

conclusion

This interview includes several feelings I had during the preparation for the interview:

  1. I’m too dishes
  2. The algorithm is interesting
  3. Play less games and study more

Finally, wish offer~

Mdnice full stack blue theme exceeded the word limit how to solve?