Leetcode: programmer interview skills

Source: Internet
Author: User

Leetcode: programmer interview skills
Cause

I wrote it at the beginning, and it took more than 20 days to show my head. After finishing the 151 questions on leetcode (many of them google), I felt like I was getting started with algorithms and data structures, but there are still many unclear points, so there is an impulse to write and analyze each question. However, after reading the leetcode article above, I decided to start with the translation and write my own experiences on the subject. Today is the first article: programmer interview skills.

If you are majoring in computer science, you may encounter many difficult programming problems when you work. When you are looking for a job, you will have a lot of interviews, and Interviewers usually like to ask you a lot of technical questions. There are three main types of questions:

  • Algorithm/Data Structure
  • Specific programming language/general computer knowledge
  • Brainstorming

    In the future, I will discuss in detail the above points:

    Algorithm/Data Structure

    You must have a deep understanding of the following data structures: arrays, linked lists, binary trees, and hash tables. You must clearly know when to use arrays or linked lists, for example, when you implement a list flip.

    The interviewer will usually ask you some algorithm questions to test your programming problem solving skills. Some algorithm problems are as follows:

    • Invert words in a sentence.
    • Invert letters in a word. (Try iteration or recursion)
    • How to find repeated numbers in a list.
    • Generates a full array of numbers n. (TIPS: recursion)
    • Find the median of two sorted arrays. (TIPS: Divide and conquer)
    • How to check spelling and verify words. (TIPS: editing distance)

      (To be honest, I cannot answer most of the questions I have asked .)

      Specific programming language/general computer knowledge

      If you are applying for a C ++ position, you need to be prepared to deal with many C ++ problems. The same applies to other programming languages. If your job does not require a specific programming language, you may be asked about general computer knowledge, such as the difference between creating objects on the heap and stack.

      I often encounter the following C ++ problems:

      • What is a virtual function? How to implement it? What are the performance problems when using virtual functions?
      • What is a virtual destructor? Why do they need them? What will happen if you do not have a false structure?
      • What is a copy constructor? When will it be called?
      • What is the difference between malloc and new?

        (The translator spoke up. The above feeling is still reliable. At least I didn't ask what virtual inheritance is! I usually ask a lot about STL during the interview. After all, it is very basic in C ++. Even if you use the Template, you can always confuse yourself, or you can skip the interview .)

        Brainstorming

        Some interviewers like to end the interview with a brain twist. This is actually very boring, but it is still honestly prepared.

        Some classic problems:

        • Two eggs:

          You have two identical eggs and 100 floors waiting for you to climb. You need to know the top layer where to drop the eggs, and the eggs won't break. (Why is it always an egg hurt ?). It is very likely that the first layer is broken, or the first layer is broken. You need to know how many times you can find the answer.

        • Reverse the bit in a byte as quickly as possible.

        • You have five identical cans containing balls. Each of the four of them is 10 Gb, and the other is 9 GB. You have an electronic name, once, find the 9g ball.

          (The problem above is an algorithm problem. Where is it, obviously, it's a dumb !)

          Summary

          Of course, this is the translator's own. The original Article is over. We can see that as a programmer, we are lucky because we are able to face so many challenges and constantly improve ourselves. But we are also depressed at the same time. In many cases, we often have the illusion that data structures and algorithms are not used in a lot of work, but linus seems to have said: "Bad programmers worry about the code. good programmers worry about data structures and their relationships ", in the book Cathedral and fair, the author directly explains "Smart data structures and dumb code works a lot better than the other way around ". Sometimes, when writing too many programs, you will naturally find the importance of algorithms and data structures.

          In addition, no matter which company you are from now, unless you are a big bull, the interview will hardly be separated from the above, so you should study honestly, cool.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.