
Snapdeal


10+ Snapdeal Software Engineer Interview Questions and Answers
Q1. Find the Next Greater Number with the Same Set of Digits
Given a string S
that represents a number, determine the smallest number that is strictly greater than the original number and has the same set of digits...read more
The task is to find the smallest number greater than the given number with the same set of digits.
Sort the digits of the number in descending order.
Find the first digit from the right that is smaller than the digit to its right.
Swap this digit with the smallest digit to its right that is greater than it.
Sort all the digits to the right of the swapped digit in ascending order to get the smallest number greater than the original number.
Q2. Vertical Sum in a Binary Tree
Given a binary tree where each node has a positive integer value, compute the vertical sum of the nodes. The vertical sum is defined as the sum of all nodes aligned along the same ...read more
Compute the vertical sum of nodes in a binary tree aligned along the same vertical line.
Traverse the binary tree in a level order manner to calculate the vertical sum.
Use a hashmap to store the vertical sum at each vertical level.
Recursively traverse the tree and update the vertical sum in the hashmap.
Output the vertical sums in the required format for each test case.
Q3. Balanced Parentheses Check
Given a string STR
consisting solely of the characters '{', '}', '(', ')', '[', and ']', determine whether the parentheses are balanced.
Input:
The first line contains an integer 'T' ...read more
Implement a function to check if parentheses in a string are balanced.
Use a stack to keep track of opening parentheses and pop when a closing parenthesis is encountered.
If the stack is empty when a closing parenthesis is encountered or if there are unmatched parentheses at the end, return 'NO'.
Ensure that all opening parentheses have a corresponding closing parenthesis in the correct order.
Return 'YES' if all parentheses are balanced.
Example: Input: {[()]}, Output: YES
Q4. Maximum Level Sum in Binary Tree Problem Statement
Given an arbitrary binary tree consisting of N nodes, where each node is associated with a certain value, your task is to find the maximum sum for any level in...read more
Find the maximum sum for any level in a binary tree.
Traverse the binary tree level by level and calculate the sum for each level.
Keep track of the maximum sum encountered so far.
Return the maximum sum found.
Example: For the input tree, the maximum level sum is 13 (5+6+2).
Q5. Find Top K Frequent Numbers in a Stream
Given an integer array ARR
and an integer K
, your task is to find the K
most frequent elements in ARR
. Return the elements sorted in ascending order.
Example:
Input:
ARR ...read more
Find the K most frequent elements in an integer array and return them sorted in ascending order.
Use a hashmap to store the frequency of each element in the array.
Use a min heap to keep track of the K most frequent elements.
Return the elements from the min heap in ascending order.
Q6. calculate the top 10 words , which comes frequently in 1 hour time span , on facebook, (dynamically)
Calculate top 10 frequently used words on Facebook in 1 hour dynamically.
Use Facebook API to fetch data
Implement a script to count word frequency
Sort the words based on frequency and return top 10
Q7. Calculate the level sum of the binary tree
Calculate the level sum of a binary tree.
Traverse the tree level by level using BFS
Add the values of nodes at each level
Store the level sum in an array
Return the array of level sums
Q8. Number of rectangles/squares in chess board
There are 204 squares and 1296 rectangles on a standard 8x8 chess board.
The number of squares can be calculated using the formula n(n+1)(2n+1)/6, where n is the number of rows/columns.
The number of rectangles can be calculated using the formula n(n+1)m(m+1)/4, where n and m are the number of rows and columns respectively.
For an 8x8 chess board, there are 64 squares of size 1x1, 49 squares of size 2x2, 36 squares of size 3x3, 25 squares of size 4x4, 16 squares of size 5x5, 9 s...read more
TCP/IP is a set of protocols that governs the way data is transmitted over the internet.
TCP/IP stands for Transmission Control Protocol/Internet Protocol.
It is a suite of communication protocols used to connect devices on the internet.
TCP ensures that data is reliably transmitted between devices.
IP is responsible for addressing and routing data packets across networks.
Examples of TCP/IP protocols include HTTP, FTP, and SMTP.
Q10. Vertical sum of binary tree
Vertical sum of binary tree is the sum of all nodes in each vertical line of the tree.
Traverse the tree in-order and keep track of the horizontal distance of each node from the root.
Use a hash table to store the sum of nodes at each horizontal distance.
Recursively traverse the left and right subtrees and update the hash table accordingly.
Q11. defective ball puzzle problem
Defective ball puzzle involves finding the odd ball out of a group of identical balls using a balance scale.
Divide the balls into groups and weigh them on the balance scale.
If the scale tips, the odd ball is in the heavier group.
If the scale doesn't tip, the odd ball is in the remaining group.
Repeat the process until the odd ball is found.
Example: 8 identical balls, one is heavier. Divide into groups of 3 and weigh. If the scale tips, weigh two of the three balls to find the ...read more
Q12. Find the pair element from the array
Find the pair element from the array
Iterate through the array and use a hashmap to store elements and their counts
Check if the current element's complement exists in the hashmap
Return the pair if found, otherwise return null
Interview Process at Snapdeal Software Engineer

Top Software Engineer Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

