SDE-2

50+ SDE-2 Interview Questions and Answers for Freshers

Updated 20 Jan 2023

Popular Companies

search-icon
Q1. Maximum Frequency Number

Ninja is given an array of integers that contain numbers in random order. He needs to write a program to find and return the number which occurs the maximum times in the given input. He ...read more

Q2. Ways To Make Coin Change

You are given an infinite supply of coins of each of denominations D = {D0, D1, D2, D3, ...... Dn-1}. You need to figure out the total number of ways W, in which you can make a change fo...read more

Frequently asked in,
Q3. Remove Consecutive Duplicates From String

You are given a string 'STR' consisting of lower and upper case characters. You need to remove the consecutive duplicates characters, and return the new string.

Exampl...read more
Ans.

The task is to remove consecutive duplicate characters from a given string and return the new string.

  • Iterate through the characters of the string

  • Compare each character with the next character

  • If they are the same, skip the next character

  • If they are different, append the current character to the new string

Q4. Sum of even & odd

Ninja got a test problem in which he was given an integer and he had to find the sum of even digits and odd digits separately.

Ninja is very weak in studies and didn’t know much about odd and e...read more

Are these interview questions helpful?
Q5. Puzzle

You are trying to cook an egg for exactly fifteen minutes, but instead of a timer, you are given two ropes which burn for exactly 1 hour each. The ropes, however, are of uneven densities – i e , half the ...read more

Q6. Find Number Of Islands

You are given a 2-dimensional array/list having N rows and M columns, which is filled with ones(1) and zeroes(0). 1 signifies land, and 0 signifies water.

A cell is said to be connected to...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
Q7. Median in a stream

Given that integers are read from a data stream. Your task is to find the median of the elements read so far.

Median is the middle value in an ordered integer list. If the size of the list is ...read more

Q8. Shopping Options

You are given the list of costs of pants in an array “pants”, shirts in an array “shirts”, shoes in an array “shoes”, and skirts in an array “skirts”. You are also given a budget amount ‘X’ to s...read more

SDE-2 Jobs

SDE-1 and SDE-2 (React Native) 1-6 years
Licious
3.7
Kochi
SDE-2 2-4 years
Simplilearn
3.2
₹ 7 L/yr - ₹ 12 L/yr
Bangalore / Bengaluru
SDE-2 Frontend 4-6 years
Hiverhq
4.1
Bangalore / Bengaluru
Q9. Maximum In Sliding Windows Of Size K

Given an array/list of integers of length ‘N’, there is a sliding window of size ‘K’ which moves from the beginning of the array, to the very end. You can only see the ‘K’ nu...read more

Q10. Maximum Number

You are given an array of N elements. This array represents the digits of a number. In an operation, you can swap the value at any two indices. Your task is to find the maximum number by using ope...read more

Q11. Basic Puzzles

A noticeable aspect in this puzzles is the fact that there’s a circular misplacement, which implies if apple is wrongly labelled as Apple, Apple can’t be labelled as Orange, i.e., it has to be labe...read more

Q12. Two Sum

You are given an array of integers 'ARR' of length 'N' and an integer Target. Your task is to return all pairs of elements such that they add up to Target.

Note:

We cannot use the element at a given inde...read more
Frequently asked in,
Q13. Maximum Depth Of A Binary Tree

You are given the root node of a binary tree with N nodes, whose nodes have integer values. Your task is to find the maximum depth of the given Binary tree.

Depth of a binary tree...read more

Q14. Reverse Linked List
Input Format :
The first line of input contains a single integer T, re...read more
Q15. Prime time again

You have been given two integers ‘DAY_HOURS’ and ‘PARTS’. Where ‘DAY_HOURS’ is the number of hours in a day and a day can be divided into ‘PARTS’ equal parts. Your task is to find total instanc...read more

Q16. Maximum Product Subarray

You are given an array “arr'' of integers. Your task is to find the contiguous subarray within the array which has the largest product of its elements. You have to report this maximum pr...read more

Q17. Equilibrium Index

You are given an array Arr consisting of N integers. You need to find the equilibrium index of the array.

An index is considered as an equilibrium index if the sum of elements of the array to t...read more

Q18. Max Submatrix

Ninja has been given a matrix ‘MAT’ of integers having size ‘N’ x ‘M’ i.e. N rows and M columns. Ninja has to find the maximum sum submatrix in it. In other words, he has to find the maximum sum ov...read more

Q19. Subarray With Given Sum

Given an array ARR of N integers and an integer S. The task is to find whether there exists a subarray(positive length) of the given array such that the sum of elements of the subarray eq...read more

Q20. Group Anagrams Together

You have been given an array/list of strings 'STR_LIST'. You are supposed to return the strings as groups of anagrams such that strings belonging to a particular group are anagrams of one...read more

Q21. Triplets with Given Sum

You are given an array/list ARR consisting of N integers. Your task is to find all the distinct triplets present in the array which adds up to a given number K.

An array is said to have a...read more

Frequently asked in,
Q22. String Transformation

Given a string (STR) of length N, you have to create a new string by performing the following operation:

Take the smallest character from the first 'K' characters of STR, remove it from STR...read more

Q23. Find Duplicate

You have been given an integer array/list(ARR) of size N which contains numbers from 0 to (N - 2). Each number is present at least once. That is, if N = 5, the array/list constitutes values rangin...read more

Q24. Ninja Port

Ninja is stuck in a city with ‘N’ colonies, and each colony contains ‘K’ houses. Ninja is currently at the house number “sourceHouse” present in the colony with colony number “sourceColony”. He wants ...read more

Q25. Clone a binary tree with random pointers.

You are given a binary tree. Apart from the left and right child pointers, each node in the given binary tree points to a random node in the given binary tree. You are s...read more

Q26. Course Schedule II

You have been given ‘N’ courses and some courses may have prerequisites. Now consider a matrix ‘PREREQUISITES’ of size 'M' x 2 which represents that you must complete course 'PREREQUISITES[i][...read more

Q27. Maximum Sum Rectangle

You are given an M X N matrix of integers ARR. Your task is to find the maximum sum rectangle.

Maximum sum rectangle is a rectangle with the maximum value for the sum of integers present wi...read more

Q28. Validate BST

You have been given a binary tree of integers with N number of nodes. Your task is to check if that input tree is a BST (Binary Search Tree) or not.

A binary search tree (BST) is a binary tree data ...read more

Q29. Minimum Operations

You are given an array 'ARR' of 'N' positive integers. You need to find the minimum number of operations needed to make all elements of the array equal. You can perform addition, multiplicatio...read more

Q30. Distance between two nodes of a Tree

Given a binary tree and the value of two nodes, find the distance between the given two nodes of the Binary Tree.

Distance between two nodes is defined as the minimum number ...read more

Q31. Edit Distance

You are given two strings 'S' and 'T' of lengths 'N' and 'M' respectively. Find the "Edit Distance" between the strings.

Edit Distance of two strings is the minimum number of steps required to make...read more

Q32. SQL Question

Write a SQL query to print the highest salary of each department in a employee table that contains employee details - department to which employee belong, salary of employee.

Q33. Add Linked Lists

Given two numbers represented by linked lists. Your task is find the sum list and return the head of the sum list.

The sum list is a linked list representation of addition of two numbers.

Input ...read more
Q34. Technical Questions

1. Whats polymorphism - compile time and run time.
2. What are exceptions in Java - Since my primary language was C++, I explained exception in C++ only.
3. What are collections in Java- list, ...read more

Q35. Technical Questions

Exception handling in C++ in detail.

What do mean by OOPS.

What is inheritance.

Create a database to store the information of employees and their salaries (just explain)

What are insertion, delet...read more

Q36. Technical Questions

What is a basic form of GRANT statement?

Calculate the result of the following prefix expression: +,-,*,8,4,/,6,2,5

If a new node is added into a red-black tree, which statements are true ?

What...read more

Q37. Technical Questions

This was taken by an SDE III guy, who again asked me about my projects for like 10 mins and then moved on to a low level design question.He asked me to design the HackerRank platform.
Again I ...read more

Q38. SQL Qusestions

What is the difference between drop and truncate?
How would you sort and display a column of table in descending order?
Create a table with primary key.
Set the marks of student to 50 whose address i...read more

Q39. System Design Questions

Design Facebook API. (Question was vague)

Given a basic interface and the list of functionality that need to implement.
And basic test cases were there again the operations.

Ans.

Design Facebook API

  • Define the basic interface for the API

  • Implement functionality for user authentication and authorization

  • Create endpoints for posting, retrieving, and deleting posts

  • Include features for liking, commenting, and sharing posts

  • Implement a search functionality for users, posts, and hashtags

  • Design a notification system for user interactions

  • Consider scalability and performance optimizations

Q40. Basic HR Questions

Why tcs?

What are your expectations?

Where do you see yourself in 5 years?

Q41. System Design Question

How to prevent breaking of singleton pattern using reflections?

Q42. DBMS Questions

1) A table was shown to me and I was asked to write a query for displaying unique elements.
2) What is RDBMS ?
3) Difference between MySql & NoSql.

Q43. Object Oriented Design Question

Started with brief intro about both(5 mins), then he jumped into LP's(25 mins). This was very difficult since there was no video and he was grilling me real hard on this, so many...read more

Q44. OOPS Question

Only java was allowed. Parent class was given and asked to write code for child classes and function overloading.

Q45. System Design Problem

Design an app like Practo.

Q46. OOPS Question

Explain oops concepts with real life examples.

Q47. DBMS Questions

Explain the concept of normalisation and types.

Q48. System Design

System design a live video broadcast platform.

Q49. System Design Question

Design LRU cache.

Q50. DBMS Question

Explain ACID properties

1
2
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10k Interviews
4.1
 • 4.9k Interviews
4.0
 • 1.3k Interviews
3.9
 • 390 Interviews
3.9
 • 201 Interviews
3.8
 • 198 Interviews
3.4
 • 140 Interviews
3.7
 • 77 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

SDE-2 Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter