SDE (Software Development Engineer)
100+ SDE (Software Development Engineer) Interview Questions and Answers

Asked in Freo

Q. Given a string, determine if it is a palindrome. You are allowed to remove at most one character to make it a palindrome.
Check if a string is a palindrome and can be made a palindrome by removing at most one character.
Iterate through the string from both ends and check if the characters match.
If the characters don't match, try removing one character from either end and check if the remaining string is a palindrome.
If removing one character doesn't make the string a palindrome, then it's not possible to make it a palindrome by removing at most one character.

Asked in Ola Cabs

Q. Implement three stacks using a single array, optimizing for space and time complexity.
Implement 3 stacks using one array with optimized space and time complexity.
Divide the array into three equal parts to represent each stack.
Keep track of the top index of each stack separately.
When pushing an element, increment the top index of the respective stack and store the element.
When popping an element, retrieve the element from the top index of the respective stack and decrement the top index.
Handle stack overflow and underflow conditions appropriately.

Asked in Myntra

Q. What is startup all about and what all technology is used
A startup is a newly established business that aims to solve a problem or meet a need using innovative technology.
Startups are focused on growth and scalability.
They often operate in a fast-paced and dynamic environment.
Startups use various technologies depending on their industry and product.
Common technologies used in startups include web and mobile development, cloud computing, data analytics, artificial intelligence, and blockchain.
Examples of startup technologies include...read more

Asked in Bombardier Transportation

Q. Explain the Waterfall model, including its advantages and disadvantages.
Waterfall model is a linear sequential approach to software development.
Advantages: clear and well-defined stages, easy to understand and manage, suitable for small projects with stable requirements
Disadvantages: inflexible, difficult to make changes once a stage is completed, testing is done only at the end, not suitable for large or complex projects
Stages: requirements gathering, design, implementation, testing, deployment, maintenance
Example: building a house, where each s...read more

Asked in Bombardier Transportation

Q. What Software Development Models are you familiar with?
Different software development models
Waterfall model
Agile model
Spiral model
V-model
Iterative model
RAD model
Prototype model
Incremental model

Asked in Dream11

Q. Given two integers, print the most common ancestor nodes of a binary tree.
Find most common ancestor nodes of a binary tree given two integers.
Traverse the tree to find the nodes with the given integers
Store the path from root to each node in separate arrays
Compare the two arrays to find the most common ancestor node
If there are multiple common ancestors, return the one closest to the root
SDE (Software Development Engineer) Jobs




Asked in Ola Cabs

Q. How can you sort an array of 0s, 1s, and 2s in O(n) time complexity and O(1) space complexity?
Dutch National Flag algorithm can be used to sort an array of 0, 1, and 2 in O(n) time complexity and O(1) space complexity.
Initialize three pointers: low, mid, and high.
Iterate through the array and swap elements based on their values.
Increment low and mid pointers when encountering 0.
Increment mid pointer when encountering 1.
Decrement high pointer when encountering 2.

Asked in Carwale

Q. What are the differences between methods and constructors? (List at least five.)
Methods are functions that perform a specific task, while constructors are special methods that initialize objects.
Constructors have the same name as the class they belong to.
Constructors are called automatically when an object is created.
Constructors can be overloaded with different parameters.
Methods can be called multiple times with different arguments.
Methods can have a return type, while constructors do not.
Share interview questions and help millions of jobseekers 🌟

Asked in Carwale

Q. What is OOP? Describe its properties.
OOP is a programming paradigm that organizes code into objects with properties and behaviors.
OOP stands for Object-Oriented Programming.
It focuses on creating reusable code by organizing it into objects.
Objects have properties (attributes) and behaviors (methods).
Encapsulation, inheritance, and polymorphism are key principles of OOP.
Example: In Java, a class represents an object with its properties and methods.

Asked in Zscaler Softech

Q. Given a rotated sorted array, find an element in it.
Finding an element in a rotated array
Identify the pivot point where the array is rotated
Divide the array into two sub-arrays based on the pivot point
Perform binary search on the appropriate sub-array to find the element
Handle edge cases like when the element is at the pivot point

Asked in Carwale

Q. What are stacks and their properties?
Stacks are a data structure that follows the Last-In-First-Out (LIFO) principle.
Stacks have two main operations: push (adds an element to the top) and pop (removes the top element).
Stacks can be implemented using arrays or linked lists.
Common applications of stacks include function call stack, undo/redo operations, and expression evaluation.
Example: A stack of books, where the last book placed is the first one to be removed.

Asked in Emtec

Q. Given a nested array like [1,3,4,[6,7,[8,5],9],2], flatten it to produce a single-dimensional array [1,3,4,6,7,8,5,9,2].
The given array needs to be flattened to a single-level array.
Iterate through the array elements
If an element is an array, recursively flatten it
If an element is not an array, add it to the result array

Asked in Carwale

Q. Write a program to print the Fibonacci series up to 1000.
Print Fibonacci series less than or equal to 1000.
Start with two variables, a and b, initialized to 0 and 1 respectively.
Print a and update a to the value of b, and b to the sum of the previous a and b.
Repeat until a exceeds 1000.

Asked in UST

Q. How do you count the number of set bits in a given number?
Count the number of set bits in a given number.
Use bitwise AND operator with 1 to check if the rightmost bit is set.
Shift the number to right by 1 bit and repeat the process until the number becomes 0.
Keep a count of the number of set bits encountered.
Example: For number 5 (101 in binary), the answer is 2 as there are 2 set bits.
Example: For number 15 (1111 in binary), the answer is 4 as there are 4 set bits.

Asked in Carwale

Q. Write a function to convert a given number to its hexadecimal form.
Convert a number to its hexadecimal form
Use the built-in function to convert the number to hexadecimal
Alternatively, use the algorithm to convert the number to hexadecimal manually
Ensure to handle negative numbers appropriately

Asked in Paychex IT Solutions India

Q. Sort the given array using only O(n) solution: [0,1,1,1,0,0,0,1,0,1,0,1,1,0,0]
Sort an array of 0s and 1s using O(n) solution.
Use two pointers, one at the beginning and one at the end of the array.
Swap the elements at the pointers if they are not in the correct order.
Move the pointers towards each other until they meet in the middle.
Time complexity is O(n) and space complexity is O(1).

Asked in Amazon

Q. Given a sorted dictionary (array of words) of an alien language, find the order of characters in the language.
Sorting a list of words with a random order using an alien dictionary
Create a graph with nodes as characters and edges as the order of characters in words
Topologically sort the graph to get the correct order of characters
Use the order to sort the list of words

Asked in Easiloan Techno Solutions

Q. Do you understand how the project directory is structured in Django?
Yes, the project directory in Django follows a specific structure.
The main project directory contains settings.py, urls.py, and wsgi.py files.
Each app within the project has its own directory with models.py, views.py, and urls.py files.
Static files are stored in a 'static' directory within each app.
Templates are stored in a 'templates' directory within each app.
Media files are stored in a 'media' directory within the project directory.

Asked in Carwale

Q. Explain the singleton class and provide example code.
Singleton class is a class that can only have one instance at a time.
Singleton pattern is used when we need to ensure that only one instance of a class is created and that instance can be accessed globally.
The constructor of a singleton class is always private to prevent direct instantiation.
A static method is used to access the singleton instance.
Example: public class Singleton { private static Singleton instance = new Singleton(); private Singleton() {} public static Single...read more

Asked in Carwale

Q. Given the head of a linked list, detect if the linked list has a cycle (i.e., a node in the list can be reached again by continuously following the next pointer). If there is a cycle, return the node where the...
read moreDetect and remove cycle in a linked list
Use two pointers, one slow and one fast, to detect a cycle
Once a cycle is detected, move one pointer to the head and iterate both pointers until they meet again
Set the next node of the last node in the cycle to null to remove the cycle

Asked in Ola Cabs

Q. Given a 2D matrix, find the submatrix with the largest sum.
Find the maximum sum of a rectangle in a 2D matrix.
Use Kadane's algorithm to find the maximum sum subarray in each row.
Iterate over all possible combinations of rows and find the maximum sum rectangle.
Keep track of the maximum sum and the coordinates of the rectangle.

Asked in MakeMyTrip

Q. Given a string a="aabbfaffb" and b="ab", write code to replace the given string and print "faffb".
Replace substring in a given string and print the remaining string
Use string.replace() method to replace the substring
Print the remaining string using string slicing

Asked in Amazon

Q. How would you store a particular data set, and what data structure would you suggest for that?
The choice of data structure depends on the type of data and the operations to be performed on it.
Consider the size and complexity of the data
Determine the operations to be performed on the data
Choose a data structure that supports those operations efficiently
Examples: arrays, linked lists, hash tables, trees, graphs

Asked in Maventic Innovative Solutions

Q. Why should we use polymorphism?
Polymorphism allows for flexibility and extensibility in code by enabling objects to take on multiple forms.
Polymorphism allows for code reuse and simplifies maintenance.
It enables the creation of generic code that can work with objects of different classes.
It allows for the creation of interfaces and abstract classes, which can be implemented by multiple classes.
Examples include using a parent class to represent multiple child classes, or implementing an interface to allow f...read more

Asked in Oracle

Q. What is Ingress? What is Prometheus ?What is Grafana?
Ingress is a Kubernetes resource that manages external access to services. Prometheus is a monitoring system and Grafana is a visualization tool.
Ingress is used to route external traffic to the appropriate Kubernetes service
Prometheus is used to collect and store metrics from various sources
Grafana is used to visualize the collected metrics in a user-friendly way
Ingress can be configured to use different load balancing algorithms
Prometheus has a powerful query language for an...read more

Asked in Optum Global Solutions

Q. How do you check whether a string is a palindrome or not?
To check if a string is palindrome or not.
Compare the first and last characters of the string and continue towards the middle until all characters have been compared.
If all characters match, the string is a palindrome.
If any characters do not match, the string is not a palindrome.

Asked in Optum Global Solutions

Q. How to find length , freq of each char and list of unique characters of a string
To find length, frequency of each character and list of unique characters of a string.
Iterate through the string and count the frequency of each character using a hash table.
Create a list of unique characters by iterating through the hash table.
Calculate the length of the string using the built-in length function.
Return the frequency, length and list of unique characters as an array of strings.

Asked in Johnson Controls

Q. What is the result of the expression 2+2-4*6?
The answer is -22
Perform multiplication first
Then perform addition and subtraction from left to right

Asked in Walmart

Q. Explain lexical scoping with an example.
Lexical scoping is a way of defining variable scope based on where they are declared in the code.
Variables declared inside a function have local scope and are not accessible outside the function.
Variables declared outside a function have global scope and can be accessed from anywhere in the code.
Nested functions can access variables declared in their parent function.
Example: function outer() { let x = 10; function inner() { console.log(x); } inner(); } outer(); // Output: 10

Asked in RadiSys

Q. Which statement about a binary heap is false?
Answering which statement about a binary heap is false.
A binary heap is a complete binary tree where the parent node is always greater or smaller than its children.
A binary heap can be represented as an array.
A binary heap can be used to implement priority queues.
A binary heap can only be a max heap and not a min heap.
Interview Experiences of Popular Companies





Top Interview Questions for SDE (Software Development Engineer) Related Skills

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


Reviews
Interviews
Salaries
Users

