Amazon | SDE1 | On Campus India | Aug 2019 [Offer]

Online Round:

This round was conducted in Mettl.

  • There were 2 coding questions -
    1. Decode Ways
    2. Given an equation of the form "num1+num2=num3", where one of num1, num2, num3 is replaced by an X. Find the value of X.
      For eg., "23+X=42" should return 19. https://leetcode.com/problems/solve-the-equation
  • 28 MCQs based on Algorithm, Data Structures and C programming.
  • Time Limit : 90 minutes.

Round - 1 (Technical):

  1. The problem was similar to 3Sum Closest, but all the given elements are positive. Think if it can be done in O(nlogn). Comment your solutions below.

Round - 2 (Technical):

  1. Given a NxN chess board, there are some black soldiers represented by 'S', some black knights represented by 'H', and a black king represented by 'K'. Also there are some friendly pieces (i.e. they do not attack but block the cell) represented by 'F'. You only have a single white knight. Find the minimum possible steps you need to take to kill the king by taking safe steps. It is assumed that the black pieces do not move but they can attack if your knight goes in their area. The knights and king attack as they do in normal chess game. But here the soldiers can attack diagonally in any direction by taking one step.

    My idea here was to do a preprocessing of the chess board and then apply bfs to find the shorter number of steps. Comment below if you have a better solution.

  2. Find the 'k' th largest element in a BST. My solution was https://www.geeksforgeeks.org/kth-largest-element-in-bst-when-modification-to-bst-is-not-allowed/ where I used O(1) space and O(h + k) time, where 'h' is the height of the tree.

Round - 3 (Technical):

  1. Find the 'k' th largest element from a stream of numbers - https://www.geeksforgeeks.org/kth-largest-element-in-a-stream/

  2. Given a set of strings such that each contains only lowercase letters. The ending character of one string can be joined to the beginning character of another string having same character. Find if a cycle can be formed by including all the given strings only once.

    For eg., Suppose the set of strings are - ["abaa", "babba", "ab"], the cycle can be - "abaa"->"ab"->"babba"->"abaa".

  3. https://leetcode.com/problems/sort-colors

  4. We had a long discussion on the projects that I have done. Be prepared for all types of questions.

  5. Questions were asked from topics like Operating Systems and Database Management Systems.

Round - 4 (Bar Raiser):

  1. Given a stream of strings and their corresponding timestamp (in seconds) when they arrive to a system. Print those strings in order which has not been printed in the last 10 seconds. Comment how you would have approached this problem. https://leetcode.com/problems/logger-rate-limiter (premium)

  2. Questions from my projects were also asked in this round.

Finally I was SELECTED !

Comments (4)