Try  HackMD Logo HackMD

Master the Coding Interview

tags: Dream Job Google Job Big Techs

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Steps To Tackle Any Coding Question

  • Step 1: Verify the constraints
    - If given a list of numbers, one can ask, "Are all numbers positive or can there be negatives?"
    - "Are there duplicate numbers in the list?"
    - "Will there always be a solution available?"
    - "Can there be more than one solution?"

    - "What do we return if there's no solution?"

  • Step 2: Write out some test cases
    - In this step, it is good to work with interviewer.
    - You may ask, "Is it okay if we come up with some test cases together that best capture the solution we seek?".

  • Step 3: Figure out a solution on paper

  • Step 4: Code the solution

  • Step 5: Test the solution

  • Step 6: Analyzing the space and time complexity

  • Step 7: Can the solution be optimized further?


Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Question 1. Two Sum

level: Easy category:Arrays

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.

More details

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Question 2. Container With Most Water

level: Medium category:Arrays
level: Medium category:Arrays

Given n non-negative integers a1, a2, , an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a container, such that the container contains the most water.

More details

Abhishek Dev