OYO interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

OYO
upvote
share-icon
3 rounds | 9 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, Algorithms, OOPS, OS, DBMS
Tip
Tip

Tip 1 : Focus on DSA as you will be judged mostly on that for entry-level software engineer profiles.
Tip 2 : Don't mug up the solution as you might not be able to recall the approach or you might face new question that you haven't seen earlier.
Tip 3 : Practice as much as possible from platforms like InterviewBit, LeetCode.

Application process
Where: Campus
Eligibility: 7 CGPA
Resume Tip
Resume tip

Tip 1 : Try not to mention those things about which you are not comfortable. 
Tip 2 : Having one or two good projects in resume helps.
Tip 3 : Mention good competitive programming ranks (if any)
Tip 4 : Use overleaf.com for making a resume using Latex.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date21 Aug 2019
Coding problem2

1. Rotate Matrix right by K times

Moderate
20m average time
80% success
0/80
Asked in companies
OYOAmazonSmart Energy Water

You have been given a matrix ‘MAT’ of size 'N' * 'M' (where 'N' and 'M' denote the number of rows and columns respectively) and a positive integer ‘K’. Your task is to rotate the matrix to the right 'K' times.

Note:
Right rotation on a matrix is shifting each column to the right side (the last column moves to the first column) and 'K' times means performing this rotation 'K' times.
Example:
For 'K' = 1 and the given 'MAT':

1 2 3
4 5 6
7 8 9

Output after rotating 'MAT' one time is:

3 1 2 
6 4 5
9 7 8
Try solving now

2. Word Search

Moderate
30m average time
50% success
0/80
Asked in companies
Goldman SachsMicrosoftSamsung

You are given a two-dimensional grid having 'N' rows and 'M' columns, consisting of upper case characters. You are also given a word 'WORD'. You have to find the number of occurrences of that word in the grid.

Starting from a given cell, a word can be formed by moving in all eight directions: horizontally left, horizontally right, vertically up, vertically down, and four diagonal directions.

Example :
There are three occurrences of the word 'NINJA' in the following grid:

word_grid

Note :
1) Given word will not be a single character.

2) If occurrences of the given word start from two different cells, then these two occurrences are considered to be different.

Consider the word 'XYX' to be searched in the string 'AXYXB'. Here, we find an occurrence of 'XYX' at index 2 going in the right direction, and another occurrence at index 4 going in the left direction.

Although these two words correspond to the same word, they will be considered as different occurrences.
Problem approach

1. Coded using recursion and backtracking but the time complexity was of exponential order so time limit exceeded.
2. Tried to code it using DFS but couldn't code it in the given time.

Try solving now
02
Round
Medium
Face to Face
Duration75 minutes
Interview date23 Oct 2020
Coding problem4

Interview started with an introduction and walk through the resume for first 5 minutes. After that, interview asked few coding questions.

1. Largest Island

Moderate
30m average time
90% success
0/80
Asked in companies
OYOAmazonIBM

You are given two integers 'n' and 'm', the dimensions of a grid. The coordinates are from (0, 0) to (n - 1, m - 1).


The grid can only have values 0 and 1.


The value is 0 if there is water and 1 if there is land.


An island is a group of ‘1’s such that every ‘1’ has at least another ‘1’ sharing a common edge.


You are given an array 'queries' of size 'q'.


Each element in 'queries' contains two integers 'x' and 'y', referring to the coordinates in the grid.


Initially, the grid is filled with 0, which means only water and no land.


At each query, the value of 'grid' at (x, y) becomes 1, which means it becomes land.


Find out, after each query, the number of islands in the grid.


Example :
Input: 'n' = 3, 'm' = 4
'queries' = [[1, 1], [1, 2], [2, 3]]

Output: [1, 1, 2]

Explanation:

Initially, the grid was:
0 0 0 0
0 0 0 0
0 0 0 0

After query (1, 1):
0 0 0 0
0 1 0 0
0 0 0 0
There is one island having land (1, 1).

After query (1, 2):
0 0 0 0
0 1 1 0
0 0 0 0
Since (1, 1) and (1, 2) share a common edge, they form one island. So there is one island having lands (1, 1) and (1, 2).

After query (2, 3):
0 0 0 0
0 1 1 0
0 0 0 1
Now there are two islands, one having lands (1, 1) and (1, 2), and another having land (2, 3).

So the number of islands after each query is [1, 1, 2].
Problem approach

1. I was little stuck in stuck in start but later on came up with DFS approach.
2. Interviewer was satisfied the approach and asked me to code it.

Try solving now

2. Given a 2D matrix having 0s and 1s, each row is sorted. Find the row having the maximum number of consecutive ones in the matrix.

Problem approach

1. Told the brute force which is to traverse the whole matrix.
2. Optimized it using binary search on each row. But interviewer want more optimized approach than this.
3. After thinking for few minutes, came up with the approach of starting from top right and take decision whether to go left or down depending on the element in left. Interviewer asked me to further optimize.
4. Optimized it by using combination of 3rd approach and binary search. After that, interviewer asked me to code it.

3. Pythagorean Triplet

Moderate
35m average time
70% success
0/80
Asked in companies
AmazonFlipkartOYO

You are given an array of n integers (a1, a2,....,an), you need to find if the array contains a pythagorean triplet or not.

An array is said to have a pythagorean triplet if there exists three integers x,y and z in the array such that x^2 + y^2 = z^2.

Note
1. The integers x,y and z might not be distinct , but they should be present at different locations in the array i.e if a[i] = x, a[j] = y and a[k] = z, then i,j and k should be pairwise distinct.
2. The integers a,b and c can be present in any order in the given array.
Try solving now

4. Top View of Binary Tree

Moderate
25m average time
70% success
0/80
Asked in companies
Samsung ElectronicsPaytm (One97 Communications Limited)JP Morgan

You are given a Binary Tree of 'n' nodes.


The Top view of the binary tree is the set of nodes visible when we see the tree from the top.


Find the top view of the given binary tree, from left to right.


Example :
Input: Let the binary tree be:

Example

Output: [10, 4, 2, 1, 3, 6]

Explanation: Consider the vertical lines in the figure. The top view contains the topmost node from each vertical line.
Try solving now
03
Round
Medium
Face to Face
Duration90 minutes
Interview date23 Aug 2019
Coding problem3

This round was focused on DSA along with short discussion on computer science fundamentals. For coding problems, I was asked to code the first problem only. For others, had to discuss the approach only. For computer science fundamentals, discussion on OOPS. Differences between process and threads were discussed.

1. Fix BST

Hard
45m average time
40% success
0/120
Asked in companies
CognizantTata 1mgMicrosoft

You have been given a Binary Search Tree of 'N' nodes, where exactly two nodes of the same tree were swapped by mistake.


Your task is to restore or fix the BST, without changing its structure and return the root of the corrected BST.


Note:

Given BST will not contain duplicates.


Example
A Binary Search Tree (BST) whose 2 nodes have been swapped is shown below.  

example

After swapping the incorrect nodes: 

example

Follow Up
Can you do this without using any extra space? 
Problem approach

After getting some of the hints, was able to come up with in-order traversal approach which takes extra space. Interviewer wanted better approach without extra space. But couldn't think of it.

Try solving now

2. Implement Stack with Linked List

Moderate
30m average time
73% success
0/80
Asked in companies
AmazonCiscoDell Technologies

You must implement the Stack data structure using a Singly Linked List.


Create a class named 'Stack' which supports the following operations(all in O(1) time):


getSize: Returns an integer. Gets the current size of the stack

isEmpty: Returns a boolean. Gets whether the stack is empty

push: Returns nothing. Accepts an integer. Puts that integer at the top of the stack

pop: Returns nothing. Removes the top element of the stack. It does nothing if the stack is empty.

getTop: Returns an integer. Gets the top element of the stack. Returns -1 if the stack is empty
Try solving now

3. Given N documents and a set of keywords was given, you have to retrieve document having highest frequency of those keywords first and then others.

Problem approach

1. Told the approach using hashmap.
2. Optimized it further by using tries.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

Which SQL keyword removes duplicate records from a result set?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by OYO
1632 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 9 problems
Interviewed by OYO
0 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by OYO
804 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 5 problems
Interviewed by OYO
570 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
107832 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
52130 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
32261 views
6 comments
0 upvotes