Thursday, July 25, 2024

Amazon Cracking The Coding Interview

Don't Miss

Flag This As Inappropriate

How I cracked my Amazon Coding Interview | Software Development Engineer Interview | Sprint Master

Would you like us to review something? Please describe the problem with this and we will look into it.

Your feedback has been sent to the team and we’ll look into it.


Glassdoor has millions of jobs plus salary information, company reviews, and interview questions from people on the inside making it easy to find a job thats right for you.

How Are The Profiles Shortlisted At Amazon

The process of profile shortlisting at Amazon is as follows:

  • First, the applications come from websites/job boards, and recruiters search profiles from social media and references.
  • Then, L4/L5 initial automated filtering happens based on skills.
  • Next, for all levels, the recruiters do manual shortlisting.
  • Finally, before the initial conversation, the recruiter forwards the shortlisted candidates to the Hiring Manager . They provide about 20-30 profiles per week to HM, and currently, 30% of sourcing is done by the HM. Amazon also makes use of the LinkedIn commons project.

Did you know? At Amazon, a Hiring Manager creates a job opening based on new needs or for attrition replacement. Annual planning starts in July at Amazon and ends in October. In this plan, the increased headcount is approved based on business growth. In fact, each job opening is approved by the finance and recruiting team, boss, and super boss. There is also a system to track all open positions and their state.

Stage : The Onsite Interview

Amazonâs onsite interview has anywhere between 4 to 5 back-to-back interviews with engineers and managers at the company, currently conducted virtually via Amazon Chime. You will receive instructions on how to set up Amazon Chime before the interview.

For SDEs and other coding-heavy roles:

Each interview will have a technical component and a behavioral component.

  • On the technical side, SDEs will have interviews dedicated to problem-solving, data structures and algorithms, coding, and system design.
  • On the behavioral side, SDEs, like all other job families, will have to answer behavioral questions that are typically around Amazonâs Leadership Principles.

For SDM/TPMs and other management roles:

Interviews will focus heavily on behavioral questions, with one interview round focusing on system design. Behavioral questions will similarly cover all relevant Amazon LPs.

Recommended Reading: How To Prepare For A Cna Job Interview

Are You Ready To Nail Your Next Coding Interview

If you are looking for help and guidance on how to prepare for that big interview, consider Interview Kickstart!

As pioneers in the field of technical interview prep, we have trained thousands of software engineers to crack the toughest coding interviews and land jobs at their dream companies, such as Google, Facebook, Apple, Netflix, Amazon, and more!

Sign up for our free webinar to learn more!

Tips To Succeed At Amazons Onsite Interview


There are a few things to keep in mind as far as the technical component of Amazonâs interviews is concerned:

  • Gather requirements: For all coding and system design problems, the first step should always be to gather all necessary requirements about the problem before you move towards a solution. Again, interviewers often keep questions intentionally ambiguous to see what kind of questions youâll ask to clarify the problem. So make sure you ask any and all questions you deem relevant.
  • Walk them through your solution: Walk your interviewer through your logic as you begin coding or designing your system. Explain why youâre taking a certain direction or making the decisions youâre currently making so that your interviewer can either understand your decision-making process or give you hints to steer you in the right direction.
  • Listen for hints and feedback: Interviewers will often drop hints if they think youâre not moving in the optimal direction. Listen closely for feedback that might help you answer the question in the best way possible. Not being attentive to feedback may work against you in the interview process.
  • Write a clean solution: Ensure that your code and design are clean, clear, and understandable. This could mean organizing your whiteboard, writing down variable names, etc.
  • Practice common DSAs: Focus your preparation on data structures and algorithms that are most commonly used, as these are more likely to come up in your interview
  • You May Like: What Type Of Questions To Ask During An Interview

    Find All Subsets Of A Given Set Of Integers

    We are given a set of integers and we have to find all the possible subsets of this set of integers. The following example elaborates on this further.

    Given set of integers:

    There are several ways to solve this problem. We will discuss the one that is neat and easier to understand. We know that for a set of n elements there are 2 n 2^n 2n subsets. For example, a set with 3 elements will have 8 subsets. Here is the algorithm we will use:

    n = size of given integer setsubsets_count = 2^nfor i = 0 to subsets_count    form a subset using the value of 'i' as following:        bits in number 'i' represent index of elements to choose from original set,        if a specific bit is 1 choose that number from original set and add it to current subset,        e.g. if i = 6 i.e 110 in binary means that 1st and 2nd elements in original array need to be picked.    add current subset to list of all subsets

    Amazon Coding Interview Questions On Graphs And Greedy Algorithms

    Graphs and Greedy Algorithms are extremely important concepts that you must master if you wish to ace Amazonâs technical interview. Here are some sample Amazon coding interview questions on Graphs.

  • Given: Adjacency list of a bidirectional graphTask: Write a code to return the adjacency list for each vertex
  • Given: A directed graphTask: Write a code to perform breadth-first traversal of this graph starting from 0
  • Given: A connected undirected graphTask: Write a program to perform depth-first traversal of the graph
  • Given: A grid of size n*n filled with 0, 1, 2, 3Task: Check whether there is a path possible from the source to destination
  • Given: A square chessboard, the initial position of the Knight, and the position of a targetTask: Write a code to find the minimum steps required by the knight to reach the target position
  • Given: An adjacency list of a graph adj with V number of vertices and having 0-based indexTask: Write a code to find whether the graph is bipartite or not
  • Given: A 2D binary matrix A of dimensions NxMTask: Find the minimum number of steps required to reach from to
  • Given: A directed graph withVvertices and E edgesTask: Find the number of strongly connected components in the graph
  • Given: A directed graphTask: Find if a vertex j is reachable from another vertex i for all vertex pairs in the given graph
  • Given: Weights and values of N itemsTask: Put these items in a knapsack of capacity W to get the maximum total value in the knapsack
  • Read Also: What Do They Ask You In An Interview

    If You’re Comfortable With Git

    Create a new branch so you can check items like this, just put an x in the brackets:

  • Fork the GitHub repo: by clicking on the Fork button.

  • Clone to your local repo:

    git clone [email protected]:< your_github_username> /coding-interview-university.gitcd coding-interview-universitygit checkout -b progressgit remote add jwasham fetch --all
  • git add .git commit -m "Marked x"git rebase jwasham/maingit push --set-upstream origin progressgit push --force
  • Find The Missing Number In The Array

    Cracking the Amazon coding interviewð¥: The definitive prep guide | Newton School

    You are given an array of positive numbers from 1 to n, such that all numbers from 1 to n are present except one number x. You have to find x. The input array is not sorted. Look at the below array and give it a try before checking the solution.

    def find_missing: #TODO: Write - Your - Code  return -1

    Click here to view the solution in C++, Java, JavaScript, and Ruby.

    Runtime Complexity: Linear,

    A naive solution is to simply search for every integer between 1 and n in the input array, stopping the search as soon as there is a missing number. But we can do better. Here is a linear, O ) O O, solution that uses the arithmetic series sum formula. Here are the steps to find the missing number:

    • Find the sum sum_of_elements of all the numbers in the array. This would require a linear scan, O
    • Then find the sum expected_sum of first n numbers using the arithmetic series sum formula
    • The difference between these i.e. expected_sum – sum_of_elements, is the missing number in the array.

    You May Like: What To Wear To An Interview 2022

    But How Do You Know What Theyre Going To Ask

    Because Cracking the Coding Interview tells you. It features nearly 200 programming questions and solutions asked by Amazon, Google, and Facebook to name a few.

    The book includes:

    • Walk through for each solution
    • Proven strategies to tackle algorithm questions
    • Extensive coverage on Big O notation, data structures and core algorithms
    • Behind the scenes look at how Google & Facebook hire developers
    • Techniques to ace the soft side of interview with behavioral questions
    • 70% more material than the 5th edition

    And thats just the beginning.

    Cracking the Coding Interview is basically two books in one.

    The first 90 or so pages goes over what to expect during the interview. And how to prepare for it.

    Then, there are hundreds upon hundreds of pages of coding problems, hints, and solutions.

    You might be thinking, Im still not convinced. Is Cracking the Coding Interviewreally worth it?

    I think so. Lets take a deeper look at what it has to offer.

    Important note: The vast majority of coding problems in this book are written in Java. If you are not proficient in Java, the coding questions will not be useful.

    Reverse Words In A Sentence

    Reverse the order of words in a given sentence .

    To solve this problem, well keep an array of size amount + 1. One additional space is reserved because we also want to store the solution for the 0 amount.

    There is only one way you can make a change of 0, i.e., select no coin so well initialize solution = 1. Well solve the problem for each amount, denomination to amount, using coins up to a denomination, den.

    The results of different denominations should be stored in the array solution. The solution for amount x using a denomination den will then be:

    solution = solution + solution

    Well repeat this process for all the denominations, and at the last element of the solution array, we will have the solution.

    Enjoying the article? Scroll down to for our free, bi-monthly newsletter.

    Read Also: Google Cloud Platform Interview Questions

    Determine If A Binary Tree Is A Binary Search Tree

    Given a Binary Tree, figure out whether its a Binary Search Tree. In a binary search tree, each nodes key value is smaller than the key value of all nodes in the right subtree, and is greater than the key values of all nodes in the left subtree. Below is an example of a binary tree that is a valid BST.

    There are several ways of solving this problem. A basic algorithm would be to check on each node where the maximum value of its left sub-tree is less than the nodes data and the minimum value of its right sub-tree is greater than the nodes data. This is highly inefficient as for each node, both of its left and right sub-trees are explored.

    Another approach would be to do a regular in-order traversal and in each recursive call, pass maximum and minimum bounds to check whether the current nodes value is within the given bounds.

    Amazon Systems Design Interview Questions

    Cracking the Coding Interview: 189 Programming Questions and Solutions ...

    Distributed systems design is an important component in the on-site interview. The design round is particularly important for senior developer and managerial positions.

    • At junior levels, youâll usually be asked no design questions.
    • At intermediate level, you can expect module or API design questions.
    • Lastly, at senior levels, you can expect system design questions.

    Here are some Amazon coding interview questions pertaining to distributed and large-scale systems:

  • Design an in-memory database system
  • Design an IP blocking system
  • Design a voting system, where people will cast their votes and the votes get added to corresponding candidates
  • Design a system to find 100 top-selling products in a given time window
  • Design an Amazon online bookstore, where users can view prices and make purchases
  • Design a system where an office administrator knows how many people are present on each floor of the building, given that the building has 3 floors
  • Design a system to upload images with tags â users would be able to visit and search for images by entering the tags
  • Design a notification service that sends notifications to multiple devices
  • Design a comprehensive workflow system that responds to pause/continue functions
  • Design a scheduler service that can manage huge schedules with minimal latency
  • Design an Instagram or Tinder.
  • Create a high level design of the black Jack video game
  • Assuming no cloud services are available, how do you scale up a web server once its popularity increases.
  • Read Also: What To Ask When Interviewing Someone

    Scoring And Evaluating System At Amazon Interviews

    After completing the Amazon interview process and answering the Amazon coding interview questions, you must wait for HR to contact you. Let’s take a look at how Amazon’s interviewers are evaluating you at the given time.

    The scoring system involves each interviewer rating the interviewee for each assigned area:

    • Strongly not acceptable

    While filling in the score, they canât see othersâ scores.

    Next, a debrief of all interviewers is held. During this debrief, the interviewers may change their scores. At the end of the discussion for hire, the HM and bar raiser have to agree. If they decide to hire, the level will be the same as interviewing for or lower. The level is finally decided by the HM and the recruiter.

    While the questions at each level may be similar, the expectated outcomes are different at each level. So the levels can be decided by the quality of answers.

    System Design Scalability Data Handling

    You can expect system design questions if you have 4+ years of experience.

    • Scalability and System Design are very large topics with many topics and resources, sincethere is a lot to consider when designing a software/hardware system that can scale.Expect to spend quite a bit of time on this
    • Considerations:
    • Distill large data sets to single values
    • Transform one data set to another
    • Handling obscenely large amounts of data

    Recommended Reading: How To Reject An Interview

    Lets Talk About My Favorite

    In many ways, Id say Twitters interviewing style was hard. But at the same time, it was more interesting and personable than other companies Ive interviewed at.

    Their interviewing process starts with an introductory phone call with an engineering manager. Thats followed up by one or two technical phone screens, depending on how you perform. If you do well, theyll fly you out to the office youre interviewing for, which was Seattle in my case. There are three 1-hour-and-15-minute rounds, each with two interviewers.

    The first two technical phone screens are the standard, run-of-the-mill technical screens where you solve coding problems on a shared coding doc.

    The onsite rounds, however, are much more conversational and feel much less intimidating. The interviewers will ask you in-depth questions about your past projects, and theyll grill you on what youve done in the past. If you claim ownership of a project, you should expect some questions about it. Youre encouraged to use them for references and to bounce ideas off of.

    I never felt any pressure to magically come up with a fully working solution, and it felt highly collaborative.

    Amazon Coding Interview Questions On Strings

    Cracking the Coding Interview (in 5 simple steps, for software engineers)

    Strings are a popular data type used to represent text characters. Below are some Amazon coding interview questions on Strings to help you prepare for your Amazon tech interview:

  • Given: String STask: Check if it is palindrome or not
  • Given: Two strings a and b consisting of lowercase charactersTask: Write a code to check whether the two strings are anagrams of each other
  • Given: String STask: Check if characters of the given string can be rearranged to form a palindrome
  • Given: String strTask: Convert the first letter of each word in the string to uppercase
  • Given: String str containing only lower case alphabetsTask: Sort it in lexicographically-descending order
  • Given: Two strings, S1 and S2Task: Write a program to merge them alternatively â the first character of S1 with the first character of S2, and so on â till the end of the string
  • Given: String S containing alphanumeric charactersTask: Find out whether the string is a palindrome or not
  • Given: String STask: Reverse the string without reversing its individual words
  • Task: Write a code to implement the function strstr. The function essentially takes two strings as arguments and locates the occurrence of the string X in the string S
  • Given: Two strings A and BTask: Find if A is a subsequence of B
  • Given: Two strings s1 and s2Task: Write a code to check if s2 is a rotated version of the string s1
  • Given: Two strings A and BTask: Find the characters that are not common in the two strings
  • You May Like: Where Can I Watch Harry And Meghan Oprah Interview

    Level Order Traversal Of Binary Tree

    Given the root of a binary tree, display the node values at each level. Node values for all levels should be displayed on separate lines. Lets take a look at the below binary tree.

    def level_order_traversal:  result = ""  #TODO: Write - Your - Code  return result

    Click here to view the solution in C++, Java, JavaScript, and Ruby.

    Runtime Complexity: Linear,

    Here, you are using two queues: current_queue and next_queue. You push the nodes in both queues alternately based on the current level number.

    Youll dequeue nodes from the current_queue, print the nodes data, and enqueue the nodes children to the next_queue. Once the current_queue becomes empty, you have processed all nodes for the current level_number. To indicate the new level, print a line break , swap the two queues, and continue with the above-mentioned logic.

    After printing the leaf nodes from the current_queue, swap current_queue and next_queue. Since the current_queue would be empty, you can terminate the loop.

    More articles

    Popular Articles