
HashedIn by Deloitte


HashedIn by Deloitte Software Engineer Interview Questions and Answers for Freshers
Q1. Check if Two Trees are Mirror
Given two arbitrary binary trees, your task is to determine whether these two trees are mirrors of each other.
Explanation:
Two trees are considered mirror of each other if:
- The r...read more
Check if two binary trees are mirrors of each other based on specific criteria.
Compare the roots of both trees.
Check if the left subtree of the first tree is the mirror of the right subtree of the second tree.
Verify if the right subtree of the first tree is the mirror of the left subtree of the second tree.
Q2. Count Ways to Reach the N-th Stair Problem Statement
You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or two step...read more
The problem involves finding the number of distinct ways to climb N stairs by taking 1 or 2 steps at a time.
Use dynamic programming to solve the problem efficiently.
The number of ways to reach the Nth stair is the sum of the number of ways to reach the (N-1)th stair and the (N-2)th stair.
Handle base cases for N=0 and N=1 separately.
Consider using modulo operation to avoid overflow for large values of N.
Q3. Tic-Tac-Toe Design Problem
Design a 2-player Tic-Tac-Toe game played on an N
* N
grid where Player 1 uses ‘X’ and Player 2 uses ‘O’. A move is always valid and occupies an empty spot.
If a player places N
of th...read more
Design a 2-player Tic-Tac-Toe game on an N x N grid where players place their marks to win by getting N marks in a row.
Create a 2D array to represent the game board.
Implement a function to check for a win after each move.
Handle player moves and update the board accordingly.
Return the result of each move (0, 1, or 2) based on the game state.
Consider horizontal, vertical, and diagonal win conditions.
Q4. Increase Number By 1 Problem Statement
Given an array of integers NUM
that consists of N
elements, where the array represents the digits of a number, your task is to add 1 to this number. The number is positive...read more
Given an array representing digits of a number, add 1 to the number.
Iterate through the array from right to left, starting with the least significant digit.
Add 1 to the current digit and check if it becomes 10. If so, set it to 0 and carry over to the next digit.
Handle the case where the most significant digit needs to be incremented by creating a new array with an extra digit.
Q5. Ways To Make Coin Change
Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more
The task is to determine the total number of ways to make change for a specified value using given denominations.
Create a dynamic programming table to store the number of ways to make change for each value up to the target value.
Iterate through each denomination and update the table accordingly based on the current denomination.
The final value in the table will represent the total number of ways to make change for the target value.
Consider edge cases such as when the target v...read more
Q6. Excel Column Number Conversion
Given a column title as it appears in an Excel sheet, your task is to return its corresponding column number.
Example:
Input:
S = "AB"
Output:
28
Explanation:
The sequence is as f...read more
Convert Excel column title to corresponding column number.
Iterate through each character in the input string
Calculate the corresponding value of each character based on its position in the alphabet
Multiply the value by 26 raised to the power of its position from the right in the input string
Sum up all the values to get the final column number
Q7. Q1 - Pre order traversal without recursion. Q2 - Reverse a linked list.
Q1 - Pre order traversal without recursion. Q2 - Reverse a linked list.
Q1: Use a stack to keep track of nodes. Start with root, push it to stack. Pop top node, print it, push right and left children to stack.
Q2: Traverse the linked list and change the direction of the pointers. Set the head of the reversed list as the last node of the original list.
Q8. Q1 - Sort the string according to frequency of characters
Sort a string based on the frequency of its characters.
Create a hash table to store the frequency of each character.
Sort the characters based on their frequency using a sorting algorithm.
Reconstruct the string based on the sorted characters and their frequency.

Top Software Engineer Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

