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

SDE - 2

PubMatic
upvote
share-icon
6 rounds | 13 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: DataStructures , Algorithms, System Design,Big Data,Spark,Optimization
Tip
Tip

Tip 1 : Be solid with the basics of Data Structures and Algorithms . Good to have end to end projects which are hosted on cloud/Github.
Tip 2 : Its always good to be presentable and have good communications skills
Tip 3 : Be honest, clear in approach and always walkthrough your thought process to the interviewer, If you do not know something kindly refuse , donot try to fake anything

Application process
Where: Linkedin
Eligibility: 2+ years of Experience in relevant field/team
Resume Tip
Resume tip

Tip 1 : Mention your projects and experience at the top. Be clear on what was done, a brief on how it was done, language /tech stack involved. If possible try to host and make it accessible. You never know if you can present it with just one click.
Tip 2 : Choose a balance between, white spaces and text, it should be well indented, no grammatical errors.
Tip 3 : It takes less than 2 min to scan a resume. Don't mention things which are irrelevant.

Interview rounds

01
Round
Medium
Video Call
Duration90 Minutes
Interview date5 Jan 2021
Coding problem3

It was a zoom call with a SDE-2 person, after 15 mins into my background he jumped directly to the questions
 

1. Time to Burn Tree

Hard
50m average time
50% success
0/120
Asked in companies
SprinklrShareChatZomato

You have a binary tree of 'N' unique nodes and a Start node from where the tree will start to burn. Given that the Start node will always exist in the tree, your task is to print the time (in minutes) that it will take to burn the whole tree.


It is given that it takes 1 minute for the fire to travel from the burning node to its adjacent node and burn down the adjacent node.


For Example :
For the given binary tree: [1, 2, 3, -1, -1, 4, 5, -1, -1, -1, -1]
Start Node: 3

    1
   / \
  2   3
     / \
    4   5

Output: 2

Explanation :
In the zeroth minute, Node 3 will start to burn.

After one minute, Nodes (1, 4, 5) that are adjacent to 3 will burn completely.

After two minutes, the only remaining Node 2 will be burnt and there will be no nodes remaining in the binary tree. 

So, the whole tree will burn in 2 minutes.
Try solving now

2. Convert binary tree to mirror tree

Easy
15m average time
85% success
0/40
Asked in companies
AdobeGoogleWalmart

Given a binary tree, convert this binary tree into its mirror tree.

A binary tree is a tree in which each parent node has at most two children.

Mirror of a Tree: Mirror of a Binary Tree T is another Binary Tree M(T) with left and right children of all non-leaf nodes interchanged.

alt text

Note:
1. Make in-place changes, that is, modify the nodes given a binary tree to get the required mirror tree.
Try solving now

3. Binary Tree Zigzag Traversal

Easy
15m average time
85% success
0/40
Asked in companies
OlaFlipkartAmazon

You have been given a Binary Tree of 'N' nodes, where the nodes have integer values. Your task is to print the zigzag traversal of the given tree.

Note:
In zigzag order, level 1 is printed from left to right fashion, level 2 is printed from right to left. and level 3 is printed from left to right again, and so on…..
For example:
For the given binary tree

1

The zigzag  traversal is [1, 4, 3, 5, 2, 7, 6]
Try solving now
02
Round
Medium
Video Call
Duration90 Minutes
Interview date7 Jan 2021
Coding problem2

Again this was a Problem Solving round taken by a SDE-2 

1. Topological Sort

Moderate
30m average time
70% success
0/80
Asked in companies
GoogleOYOAmazon

A Directed Acyclic Graph (DAG) is a directed graph that contains no cycles.

Topological Sorting of DAG is a linear ordering of vertices such that for every directed edge from vertex ‘u’ to vertex ‘v’, vertex ‘u’ comes before ‘v’ in the ordering. Topological Sorting for a graph is not possible if the graph is not a DAG.

Given a DAG consisting of ‘V’ vertices and ‘E’ edges, you need to find out any topological sorting of this DAG. Return an array of size ‘V’ representing the topological sort of the vertices of the given DAG.

For example, Consider the DAG shown in the picture.

alt tex

In this graph, there are directed edges from 0 to 1 and 0 to 3, so 0 should come before 1 and 3. Also, there are directed edges from 1 to 2 and 3 to 2 so 1 and 3 should come before 2.

So, The topological sorting of this DAG is {0 1 3 2}.

Note that there are multiple topological sortings possible for a DAG. For the graph given above one another topological sorting is: {0, 3, 1, 2}

Note:
1. It is guaranteed that the given graph is DAG.
2. There will be no multiple edges and self-loops in the given DAG.
3. There can be multiple correct solutions, you can find any one of them. 
4. Don’t print anything, just return an array representing the topological sort of the vertices of the given DAG.
Try solving now

2. Technical Questions

Started off by asking Java Fundamentals, OOPS , Design Patters (Singleton, Factory, Cascade), HashMap Internals, Collections, Fail Fast-Fail Safe Iterators
Then jumped off to Problem Solving - Egg Dropping Problem(Learn)
 

03
Round
Hard
Video Call
Duration100 Minutes
Interview date12 Jan 2021
Coding problem2

This round was with a SDE-3(Principal Engineer)

1. Trailing Zeros in Factorial

Moderate
15m average time
80% success
0/80
Asked in companies
UberGoldman SachsTata 1mg

You are given an integer N, you need to find the number of trailing zeroes in N! (N factorial).

Note:

1. Trailing zeros in a number can be defined as the number of continuous suffix zeros starting from the zeroth place of a number.
2. For example, if a number X = 1009000, then the number of trailing zeros = 3 where the zeroth place is 0, the tenth place is 0, the hundredth place is 0.
3. ! means “FACTORIAL”. Factorial of a number is calculated by the product of the integer and all integers below it till 1.
4. Value of 0! is 1.
Try solving now

2. Technical Questions

He took a deep dive into my resume and asked a lot of questions around my projects asking my roles and responsibilities in each project/product/team. Asked about Kadane's Algorithm.
After that he started with Spark Theory based questions: 

MapReduce Concepts in deep, Shuffle internals, Questions on Hive , re-partition, MSCK repair tables, RDDs, Catalyst optimizer, Lineage Graph, SparkDrive, Spark Submit, Implementation of Split in Reduce Stage, Narrow and Wide Dependancy, Internal and External Tables, Caching a Query in Internal Table, Optimization of SQL query.

Every question was asked in a rapid fire manner

SQL query Using Dense Rank 

04
Round
Hard
Video Call
Duration90 Minutes
Interview date18 Jan 2021
Coding problem1

This round was scheduled with a SDE-3/SDE-4(Senior Principal Engineer):
He directly started with questions after my introduction of 5mins
 

1. Technical Questions

Question 1 : A scenario/story where Bitonic Sequence was to be implemented.
Question 2 : Design a Scheduler for scheduling n jobs with input give at the runtime , input can be the also generic service to be called.
Question 3 : Assuming you are dumping data in-memory via a data-pipeline , Design a garbage collector that will remove unsed data.(I gave and explained Mark and sweep Algorithm).
Follow-up Questions - What are memory Leaks,how will you calculate free-unused memory, how will you evict used memory, Optimal DS used in this.

05
Round
Medium
Video Call
Duration90 Miinutes
Interview date20 Jan 2021
Coding problem3

Discussion with Hiring Manager
 

1. Loot Houses

Moderate
26m average time
0/80
Asked in companies
CognizantTata Consultancy Services (TCS)Paytm (One97 Communications Limited)

A thief wants to loot houses. He knows the amount of money in each house. He cannot loot two consecutive houses. Find the maximum amount of money he can loot.

Try solving now

2. Technical Questions

Deep-Discussion on my projects. 

My Approach on there use cases /or the problem they were facing. 

Questions on Spark(Broadcast Join Scenario), Questions on Map-reduce (Scenario Based)
Question on String Pool, String Buffer internals, Multi-threading, Concurrency

3. Basic HR Questions

What are my Aspirations? 

How do I motivate myself? 

What sort of disappointment I faced in life? 

Situations where your solution was accepted other than your peers and How did you convince the management for this. 

What was the hardest situation overcomed in Life? (I gave My weight transformation from 110 to 60 kg, he did not believe it so showed Facebook Picture)

06
Round
Easy
Video Call
Duration75 Minutes
Interview date22 Jan 2021
Coding problem2

This round was with VP in Redwood City , it was scheduled around 11:00 pm IST
 

1. Basic HR Questions

How is your relationships with your seniors? 

What is the most difficult problem you ever faced and how you solved it? 

What is your Normal day routine?

How do I manage a stressful situation? 

What role have you played which involved your Leadership skills?

Why I want to join there company, 

What will happen If I get rejected from this stage? 

What are my Life Aspirations?

2. Technical Questions

Discussion on my resume, Work exp, Team Size, Duration of Projects

Why did you switch 2 companies with your experience and why do you want to switch and come here(Despite my answer he advised me to be patient and wait for opportunities).
Discussion on OS, Semaphores,Mutexes,Case Scenarios, Locks 
Locking In Distributed Env(1 Phase Vs 2 Phase VS 3 Phase Commits), SpinLocks
Implement a SpinLock(Low level Design)

Data Base Optimization

Here's your problem of the day

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

Skill covered: Programming

Which operator is used for exponentiation in Python?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Amazon
3204 views
0 comments
0 upvotes
Analytics Consultant
3 rounds | 10 problems
Interviewed by ZS Associates
355 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
1302 views
0 comments
0 upvotes
company logo
SDE - 2
4 rounds | 6 problems
Interviewed by Expedia Group
865 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 2
3 rounds | 4 problems
Interviewed by HashedIn
8257 views
0 comments
0 upvotes
company logo
SDE - 2
3 rounds | 4 problems
Interviewed by Arcesium
1370 views
0 comments
0 upvotes
company logo
SDE - 2
3 rounds | 3 problems
Interviewed by Tata Consultancy Services (TCS)
1442 views
0 comments
0 upvotes