Upload Button Icon Add office photos
Premium Employer

i

This company page is being actively managed by PubMatic Team. If you also belong to the team, you can get access from here

PubMatic Verified Tick

Compare button icon Compare button icon Compare

Filter interviews by

PubMatic SDE-2 Interview Questions, Process, and Tips

Updated 16 Sep 2021

PubMatic SDE-2 Interview Experiences

1 interview found

SDE-2 Interview Questions & Answers

user image Anonymous

posted on 16 Sep 2021

I was interviewed in Jan 2021.

Round 1 - Video Call 

(3 Questions)

Round duration - 90 Minutes
Round difficulty - Medium

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

  • Q1. 

    Binary Tree Zigzag Traversal Problem Statement

    Given a Binary Tree comprised of 'N' nodes with integer values, your task is to print the zigzag traversal of the tree.

    Note:

    The zigzag pattern implies th...

  • Ans. Brute force

    We can use level order traversal (recursive) to explore all levels of the tree. Also, at each level nodes should be printed in alternating order. 

     

    For example - First level of tree should be printed in left to right manner, Second level of tree should be printed in right to left manner, Third again in left to right order and so on.

     

    So, we will use a Direction variable whose value will toggle a...

  • Answered Anonymously
  • Q2. 

    Convert Binary Tree to Mirror Tree

    Convert a given binary tree into its mirror tree, where the left and right children of all non-leaf nodes are interchanged.

    Input:

    An integer ‘T’ denoting the number o...
  • Ans. Recursive approach.

    The idea is to traverse the binary tree and swap the left and right subtrees.

     

    The steps are as follows:

     

    1. Call mirror function as mirror(node->left)  to access the left subtree.
    2. Call mirror function as mirror(node->right) to access the right subtree.
    3. Swap left and right subtrees using:
    • ‘TEMP’ = leftSubtree
    • leftSubtree = rightSubtree
    • rightSubtree = ‘TEMP’
    Space Complexity: O(n)Explanation...
  • Answered Anonymously
  • Q3. 

    Time to Burn Tree Problem

    You are given a binary tree consisting of 'N' unique nodes and a start node where the burning will commence. The task is to calculate the time in minutes required to completely b...

  • Ans. Using BFS

    The idea is to first create an undirected graph of the given binary tree and then doing a bfs traversal of the undirected graph starting from the start node. We will keep a variable ‘count’ that will be incremented at each level of bfs traversal. ‘count-1’ is the required time needed to burn the whole tree.

     

    Algorithm

     

    • Initialize an unordered map ‘M’ that maps from integer to array of integers that sto...
  • Answered Anonymously
Round 2 - Video Call 

(1 Question)

Round duration - 90 Minutes
Round difficulty - Medium

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

  • Q1. 

    Topological Sort Problem Statement

    Given a Directed Acyclic Graph (DAG) consisting of V vertices and E edges, your task is to find any topological sorting of this DAG. You need to return an array of size ...

  • Ans. Modify Depth First Search

    In the Depth First Search (DFS), we start from a vertex, we first print it and then recursively call DFS for its adjacent vertices. In topological sorting, we use a  stack. We don’t print the vertex immediately, we first recursively call topological sorting for all its adjacent vertices, then push it to a stack. Finally, print contents of the stack. Note that a vertex is pushed to stack on...

  • Answered Anonymously
Round 3 - Video Call 

(1 Question)

Round duration - 100 Minutes
Round difficulty - Hard

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

  • Q1. 

    Trailing Zeros in Factorial Problem

    Find the number of trailing zeroes in the factorial of a given number N.

    Input:

    The first line contains an integer T representing the number of test cases.
    Each of the...
  • Ans. Find the factorial of the number
    • Calculate the factorial of N.
    • Initialise FACT = 1 to store factorial of N, iterate 1 <= i <= N and do FACT = FACT * i.
    • Count the number of trailing zeroes in FACT. Initialise ZEROES = 0.
    • Repeatedly divide the FACT by 10, if the remainder is 0, increase ZEROES by 1. If the remainder > 0, stop and return ZEROES.
    Space Complexity: O(1)Explanation:

    O(1), as we are using constant extra m...

  • Answered Anonymously
Round 4 - Video Call 

Round duration - 90 Minutes
Round difficulty - Hard

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

Round 5 - Video Call 

(1 Question)

Round duration - 90 Miinutes
Round difficulty - Medium

Discussion with Hiring Manager
 

  • Q1. 

    Loot Houses Problem Statement

    A thief is planning to steal from several houses along a street. Each house has a certain amount of money stashed. However, the thief cannot loot two adjacent houses. Determi...

  • Ans. Recursive Approach

    Suppose that the robber is at the ith house. The robber has two options:

    • If he decides to rob this house, then he cannot rob the next house, so he’ll have to go to the house after that.
    • If he decides not to rob this house, he has no restriction over choosing the next house.

    You will follow the same for the rest of the houses. Thus, if maxLoot(i) is the maximum loot possible when we’re at the ith house, t...

  • Answered Anonymously
Round 6 - Video Call 

Round duration - 75 Minutes
Round difficulty - Easy

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

Interview Preparation Tips

Professional and academic backgroundI completed Computer Science Engineering from Guru Gobind Singh Indraprastha University. I applied for the job as SDE - 2 in PuneEligibility criteria2+ years of Experience in relevant field/teamPubMatic interview preparation:Topics to prepare for the interview - DataStructures , Algorithms, System Design,Big Data,Spark,OptimizationTime required to prepare for the interview - 3 monthsInterview preparation tips for other job seekers

Tip 1 : Be solid with the basics of Ds, Algo. 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 dont know something kindly refuse , dont try to fake anything

Application resume tips for other job seekers

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.

Final outcome of the interviewSelected

Skills evaluated in this interview

Interview questions from similar companies

Interview experience
3
Average
Difficulty level
Moderate
Process Duration
Less than 2 weeks
Result
No response

I applied via Naukri.com and was interviewed in Jan 2023. There were 2 interview rounds.

Round 1 - Technical 

(10 Questions)

  • Q1. Basic OOP's Concepts
  • Q2. What's Copy Constructor and how and why it is used
  • Ans. 

    Copy constructor creates a new object by copying the values of an existing object.

    • Copy constructor is used to create a new object with the same values as an existing object.

    • It is invoked when a new object is initialized with an existing object.

    • It is used to avoid shallow copy and ensure deep copy of objects.

    • Example: MyClass obj1; MyClass obj2 = obj1; //copy constructor called to create obj2

  • Answered by AI
  • Q3. What's shallow and deep copy
  • Ans. 

    Shallow copy creates a new object with the same reference as the original, while deep copy creates a new object with a new reference.

    • Shallow copy only copies the reference to the original object, so changes made to the copy will affect the original object.

    • Deep copy creates a new object with a new reference, so changes made to the copy will not affect the original object.

    • In Python, shallow copy can be made using the cop...

  • Answered by AI
  • Q4. How vector works internally
  • Ans. 

    Vectors are dynamic arrays that allocate memory dynamically. They work by storing elements in contiguous memory locations.

    • Vectors allocate memory dynamically and store elements in contiguous memory locations

    • They can be resized dynamically as needed

    • Accessing elements is done using an index, similar to arrays

    • Inserting or deleting elements in the middle of a vector can be expensive as it requires shifting all subsequent e...

  • Answered by AI
  • Q5. Different containers in STL
  • Ans. 

    STL provides various containers like vector, list, map, set, etc.

    • Vector: Dynamic array with contiguous memory allocation

    • List: Doubly linked list

    • Map: Associative container with key-value pairs

    • Set: Associative container with unique keys

    • Deque: Double-ended queue

    • Stack: LIFO data structure

    • Queue: FIFO data structure

  • Answered by AI
  • Q6. What's difference between ordered map and unordered map
  • Ans. 

    Ordered map maintains the order of insertion while unordered map does not.

    • Ordered map is implemented using a balanced binary search tree while unordered map is implemented using a hash table.

    • Ordered map is useful when we need to maintain the order of insertion while unordered map is useful when we need faster access to elements.

    • Example of ordered map: std::map in C++, Example of unordered map: std::unordered_map in C++

  • Answered by AI
  • Q7. What's' polymorphism and how it works
  • Ans. 

    Polymorphism is the ability of an object to take on many forms. It allows objects of different classes to be treated as if they were the same type.

    • Polymorphism is achieved through method overriding and method overloading.

    • Method overriding is when a subclass provides a specific implementation of a method that is already provided by its parent class.

    • Method overloading is when a class has two or more methods with the same...

  • Answered by AI
  • Q8. How compiler differentiate between different function with same signature. Name mangling
  • Ans. 

    Name mangling is used by compilers to differentiate between different functions with the same signature.

    • Name mangling is a process of encoding/decoding function names to include additional information such as parameter types and namespaces.

    • This allows the compiler to differentiate between functions with the same name and signature.

    • For example, in C++, two functions with the same name and signature but in different name...

  • Answered by AI
  • Q9. Write C++ program to find absolute difference between sum of diagonal elements
  • Ans. 

    C++ program to find absolute difference between sum of diagonal elements

    • Create a 2D array

    • Calculate sum of diagonal elements

    • Calculate absolute difference

    • Print the result

  • Answered by AI
  • Q10. How does virtual function works. What's Vptr and Vtable. Why virtual function is needed
  • Ans. 

    Virtual functions allow dynamic binding of functions at runtime. Vptr and Vtable are used to implement this feature.

    • Virtual functions are declared in base class and can be overridden in derived classes.

    • Vptr is a pointer to Vtable which contains addresses of virtual functions.

    • Virtual function is needed to achieve polymorphism and to allow derived classes to have their own implementation of a function.

    • Virtual functions a...

  • Answered by AI
Round 2 - Technical 

(5 Questions)

  • Q1. Brief about background, experience and projects
  • Ans. 

    I am a software engineer with 5 years of experience in developing web applications and mobile apps.

    • Developed a web application for a healthcare company using React and Node.js

    • Built a mobile app for a retail company using React Native

    • Worked on a project for a financial institution using Java and Spring Framework

    • Experience in Agile methodology and Scrum framework

    • Strong skills in problem-solving and debugging

  • Answered by AI
  • Q2. Few code snippet regarding memory leak how you will resolve them
  • Q3. Code snippet regarding how virtual function will work. With and without virtual keyword
  • Q4. Given one point and circle how will you find if it's inside circle or outside circle
  • Ans. 

    Check if a point is inside or outside a circle

    • Calculate the distance between the center of the circle and the given point using the distance formula

    • If the distance is less than the radius of the circle, the point is inside the circle

    • If the distance is equal to the radius of the circle, the point is on the circle

    • If the distance is greater than the radius of the circle, the point is outside the circle

  • Answered by AI
  • Q5. What's smart pointers Which IDE you use Have you used GDB?
  • Ans. 

    Smart pointers are objects that manage the memory of dynamically allocated objects, preventing memory leaks and dangling pointers.

    • Smart pointers are a type of RAII (Resource Acquisition Is Initialization) technique.

    • They automatically delete the object they point to when it is no longer needed.

    • Examples of smart pointers include unique_ptr, shared_ptr, and weak_ptr in C++.

    • They are used to prevent memory leaks and danglin...

  • Answered by AI

Interview Preparation Tips

Topics to prepare for Altair Engineering Sde1 interview:
  • C++
  • Aptitude
Interview preparation tips for other job seekers - Keep basics clear and prepare for aptitude questions also

Skills evaluated in this interview

Tell us how to improve this page.

Interview Questions from Similar Companies

Globant Interview Questions
3.8
 • 172 Interviews
Grey Orange Interview Questions
3.2
 • 38 Interviews
Mobileum Interview Questions
3.3
 • 37 Interviews
InMobi Interview Questions
3.5
 • 35 Interviews
CodeClouds Interview Questions
4.5
 • 35 Interviews
View all
Softwaretest Engineer
102 salaries
unlock blur

₹3.4 L/yr - ₹5.1 L/yr

Senior Software Engineer
80 salaries
unlock blur

₹12 L/yr - ₹39.1 L/yr

Software Engineer
72 salaries
unlock blur

₹8 L/yr - ₹27 L/yr

Principal Software Engineer
46 salaries
unlock blur

₹19.5 L/yr - ₹51 L/yr

QA Engineer
27 salaries
unlock blur

₹3.5 L/yr - ₹4.9 L/yr

Explore more salaries
Compare PubMatic with

InMobi

3.5
Compare

Komli Media

4.0
Compare

Adcolony

5.0
Compare

Affle

3.1
Compare
Did you find this page helpful?
Yes No
write
Share an Interview