Add office photos
Deloitte logo
Premium Employer

Deloitte

Verified
3.8
based on 17.9k Reviews
Video summary
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by
Software Developer
Fresher
Experienced
Skills
Clear (2)

Deloitte Software Developer Interview Questions and Answers for Freshers

Updated 5 Feb 2024

Q1. Find K'th Character of Decrypted String

You are given an encrypted string where repeated substrings are represented by the substring followed by its count. Your task is to find the K'th character of the decrypt...read more

Ans.

Given an encrypted string with repeated substrings represented by counts, find the K'th character of the decrypted string.

  • Parse the encrypted string to extract substrings and their counts

  • Iterate through the substrings and counts to build the decrypted string

  • Track the position in the decrypted string to find the K'th character

View 1 answer
right arrow

Q2. Pair Sum Problem Statement

You are provided with an array ARR consisting of N distinct integers in ascending order and an integer TARGET. Your objective is to count all the distinct pairs in ARR whose sum equal...read more

Ans.

Count distinct pairs in an array whose sum equals a given target.

  • Use two pointers approach to iterate through the array and find pairs with sum equal to target.

  • Keep track of visited pairs to avoid counting duplicates.

  • Return -1 if no such pair exists with the given target.

View 1 answer
right arrow

Q3. Sort 0 1 2 Problem Statement

Given an integer array arr of size 'N' containing only 0s, 1s, and 2s, write an algorithm to sort the array.

Input:

The first line contains an integer 'T' representing the number of...read more
Ans.

Sort an array of 0s, 1s, and 2s in linear time complexity.

  • Use three pointers to keep track of the positions of 0s, 1s, and 2s in the array.

  • Iterate through the array and swap elements based on the values encountered.

  • Maintain left pointer for 0s, right pointer for 2s, and current pointer for traversal.

  • Example: If current element is 0, swap it with element at left pointer and increment both pointers.

View 1 answer
right arrow

Q4. Cycle Detection in Undirected Graph Problem Statement

You are provided with an undirected graph containing 'N' vertices and 'M' edges. The vertices are numbered from 1 to 'N'. Your objective is to determine whe...read more

Ans.

Detect if an undirected graph contains a cycle.

  • Use Depth First Search (DFS) to traverse the graph and detect cycles.

  • Maintain a visited array to keep track of visited vertices.

  • If a visited vertex is encountered again during DFS, a cycle exists.

  • Check for back edges while traversing the graph.

  • Consider disconnected graphs as well.

Add your answer
right arrow
Discover Deloitte interview dos and don'ts from real experiences

Q5. Next Smaller Palindrome Problem Statement

You are given a palindrome number represented as a string S. Your task is to find the largest palindrome number that is strictly less than S.

Example:

Input:
T = 2
S1 = ...read more
Ans.

Given a palindrome number represented as a string, find the largest palindrome number that is strictly less than the given number.

  • Iterate from the middle towards the start and end of the string to find the next smaller palindrome.

  • If the number is odd in length, simply mirror the left half to the right half to get the next smaller palindrome.

  • If the number is even in length, decrement the middle digit and mirror the left half to the right half to get the next smaller palindrome...read more

Add your answer
right arrow

Q6. Longest Common Subsequence Problem Statement

Given two strings STR1 and STR2, determine the length of their longest common subsequence.

A subsequence is a sequence that can be derived from another sequence by d...read more

Ans.

The problem involves finding the length of the longest common subsequence between two given strings.

  • Use dynamic programming to solve this problem efficiently.

  • Create a 2D array to store the lengths of common subsequences of substrings.

  • Iterate through the strings to fill the array and find the length of the longest common subsequence.

  • Example: For input STR1 = 'abcde' and STR2 = 'ace', the longest common subsequence is 'ace' with a length of 3.

Add your answer
right arrow

Q7. Boundary Traversal of a Binary Tree

Given a binary tree of integers, your task is to output the boundary nodes of this binary tree in Anti-Clockwise order, starting from the root node.

Explanation:

The boundary...read more

Ans.

Output the boundary nodes of a binary tree in Anti-Clockwise order, starting from the root node.

  • Traverse the left boundary nodes in top-down order

  • Traverse the leaf nodes from left to right

  • Traverse the right boundary nodes in bottom-up order

  • Combine the above traversals to get the boundary nodes in Anti-Clockwise order

Add your answer
right arrow

Q8. Search an Element in a Sorted Array

Given a sorted array 'A' of 'N' integers, determine whether a number 'X' exists within this array for a series of queries. For each query, print 1 if 'X' exists in the array,...read more

Ans.

Search for a number in a sorted array and determine its existence for multiple queries.

  • Use binary search algorithm to efficiently search for each query integer in the sorted array.

  • For each query integer 'X', check if it exists in the array 'A' and output 1 if found, 0 otherwise.

  • Ensure the array 'A' is sorted in non-decreasing order to apply binary search effectively.

Add your answer
right arrow
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

Practo Logo
3.1
 • 35 Interview Questions
NeoSOFT Logo
3.6
 • 14 Interview Questions
eBay Logo
3.8
 • 12 Interview Questions
Qualcomm Logo
3.8
 • 11 Interview Questions
View all
Recently Viewed
SALARIES
Accenture
INTERVIEWS
Accenture
No Interviews
SALARIES
Accenture
INTERVIEWS
Cognizant
No Interviews
LIST OF COMPANIES
Discover companies
Find best workplace
INTERVIEWS
HCLTech
No Interviews
INTERVIEWS
Intouch
No Interviews
REVIEWS
AU Small Finance Bank
No Reviews
INTERVIEWS
TCS
No Interviews
INTERVIEWS
Wipro
No Interviews
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

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