QUESTION 1: Even Sum Pair Formation ⭐⭐⭐
Difficulty: Medium | Frequency: 95% | Year: 2024-2025
Problem Statement: Given an array of N integers, determine whether it’s possible to divide all numbers into pairs such that the sum of each pair is even. Every element must be paired exactly once. Print “YES” if possible, otherwise “NO”.
Input Format:
First line: N (number of elements)
Second line: N space-separated integers
Output Format:
YES or NO
Sample Input:
6
2 3 4 5 6 7
Sample Output:
YES
QUESTION 2: Binary Virus (Bit Manipulation) ⭐⭐⭐
Difficulty: Easy-Medium | Frequency: 98% | Year: 2023-2025
Problem Statement: Every decimal number can be converted to binary. Your computer has a “Corona Virus” that eats binary digits from the right side (LSB – Least Significant Bits). If the virus has ‘k’ spikes, it will eat ‘k’ LSB binary digits from your numbers.
Given an array of N numbers and spike count k, calculate the final values after the virus attack.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Third line: k (number of spikes/bits to remove)
Output Format:
N space-separated integers (final values)
Sample Input:
3
8 15 20
2
Sample Output:
2 3 5
QUESTION 3: Linked List Momentum Calculation ⭐⭐
Difficulty: Easy | Frequency: 92% | Year: 2024-2025
Problem Statement: Ratul made a linked list of N nodes where each node has two variables: the velocity and the mass of a particle. Since all particles have velocity in the same direction, find the total momentum of the entity made by the particles from the linked list.
Formula: Momentum = mass × velocity
Input Format:
First line: n (number of nodes)
Next n lines: mass velocity (space-separated)
Output Format:
Single integer denoting total momentum
Sample Input:
4
1 3
2 4
2 3
4 5
Sample Output:
37
QUESTION 4: Minimum String Deletions (Palindrome) ⭐⭐⭐
Difficulty: Medium | Frequency: 85% | Year: 2024-2025
Problem Statement: Given a string, find the minimum number of character deletions required to make it a non-palindrome. If the string is already a non-palindrome, return 0. If it’s impossible to make it non-palindrome (all characters are same), return -1.
Input Format:
Single string S
Output Format:
Single integer (minimum deletions)
Sample Input 1:
aabaa
Sample Output 1:
1
Sample Input 2:
aaaa
Sample Output 2:
-1
Sample Input 3:
abc
Sample Output 3:
0
QUESTION 5: Second Largest Element ⭐⭐
Difficulty: Easy | Frequency: 90% | Year: 2023-2025
Problem Statement: Find the second largest element in an array without using sorting. If second largest doesn’t exist, print -1.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Output Format:
Single integer (second largest element or -1)
Sample Input:
6
12 35 1 10 34 1
Sample Output:
34
QUESTION 6: Move All Zeros to End ⭐⭐
Difficulty: Easy | Frequency: 88% | Year: 2023-2025
Problem Statement: Move all zeros to the end of array while maintaining the relative order of non-zero elements.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Output Format:
Modified array with zeros at end
Sample Input:
5
0 1 0 3 12
Sample Output:
1 3 12 0 0
QUESTION 7: Anagram Check ⭐⭐
Difficulty: Easy | Frequency: 92% | Year: 2023-2025
Problem Statement: Check if two strings are anagrams of each other. Two strings are anagrams if they contain the same characters with the same frequency.
Input Format:
Two lines with two strings
Output Format:
1 if anagram, 0 if not
Sample Input:
listen
silent
Sample Output:
1
QUESTION 8: First Non-Repeating Character ⭐⭐
Difficulty: Easy-Medium | Frequency: 84% | Year: 2024-2025
Problem Statement: Find the first non-repeating character in a string. If no such character exists, return -1.
Input Format:
Single string
Output Format:
First non-repeating character or -1
Sample Input:
programming
Sample Output:
p
QUESTION 9: Leaders in Array ⭐⭐⭐
Difficulty: Medium | Frequency: 78% | Year: 2023-2024
Problem Statement: An element is a leader if it is greater than all elements to its right. The rightmost element is always a leader. Find all leaders in the array and print them in the order they appear.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Output Format:
All leaders space-separated
Sample Input:
6
16 17 4 3 5 2
Sample Output:
17 5 2
QUESTION 10: Digital Root (Sum Until Single Digit) ⭐⭐
Difficulty: Easy | Frequency: 80% | Year: 2023-2024
Problem Statement: Given a number, keep adding its digits until you get a single digit. This is called the digital root.
Input Format:
Single integer N
Output Format:
Single digit result
Sample Input:
9875
Sample Output:
2
Explanation:
9 + 8 + 7 + 5 = 29
2 + 9 = 11
1 + 1 = 2
QUESTION 11: Sum of Even Numbers in Array ⭐
Difficulty: Very Easy | Frequency: 75% | Year: 2024
Problem Statement: Calculate the sum of all even numbers in the given array.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Output Format:
Single integer (sum of even numbers)
Sample Input:
5
1 2 3 4 5
Sample Output:
6
QUESTION 12: Count Subarrays with Odd Sum ⭐⭐⭐
Difficulty: Medium | Frequency: 72% | Year: 2024
Problem Statement: Count the number of subarrays where the sum of elements is odd.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Output Format:
Single integer (count of subarrays)
Sample Input:
4
1 2 3 4
Sample Output:
6
QUESTION 13: Reverse Words in String ⭐⭐
Difficulty: Easy | Frequency: 86% | Year: 2023-2024
Problem Statement: Reverse the order of words in a given string while maintaining the word order intact.
Input Format:
Single string with words separated by spaces
Output Format:
String with reversed word order
Sample Input:
Welcome to Deloitte
Sample Output:
Deloitte to Welcome
QUESTION 14: Check Prime Number ⭐
Difficulty: Very Easy | Frequency: 82% | Year: 2023-2024
Problem Statement: Check if a given number is prime or not.
Input Format:
Single integer N
Output Format:
"Prime" or "Not Prime"
Sample Input:
17
Sample Output:
Prime
QUESTION 15: Fibonacci Series ⭐
Difficulty: Easy | Frequency: 88% | Year: 2023-2024
Problem Statement: Print the first N Fibonacci numbers.
Input Format:
Single integer N
Output Format:
N space-separated Fibonacci numbers
Sample Input:
7
Sample Output:
0 1 1 2 3 5 8
QUESTION 16: Armstrong Number Check ⭐⭐
Difficulty: Easy | Frequency: 76% | Year: 2023-2024
Problem Statement: Check if a given number is an Armstrong number. An Armstrong number is a number that is equal to the sum of its own digits raised to the power of the number of digits.
Input Format:
Single integer N
Output Format:
"Armstrong Number" or "Not Armstrong Number"
Sample Input:
153
Sample Output:
Armstrong Number
Explanation:
153 = 1³ + 5³ + 3³ = 1 + 125 + 27 = 153
QUESTION 17: GCD of Two Numbers ⭐⭐
Difficulty: Easy | Frequency: 70% | Year: 2023-2024
Problem Statement: Find the Greatest Common Divisor (GCD) of two numbers.
Input Format:
Two space-separated integers
Output Format:
Single integer (GCD)
Sample Input:
36 60
Sample Output:
12
QUESTION 18: LCM of Two Numbers ⭐⭐
Difficulty: Easy | Frequency: 68% | Year: 2023-2024
Problem Statement: Find the Least Common Multiple (LCM) of two numbers.
Input Format:
Two space-separated integers
Output Format:
Single integer (LCM)
Sample Input:
4 6
Sample Output:
12
QUESTION 19: Factorial of Number ⭐
Difficulty: Very Easy | Frequency: 84% | Year: 2023-2024
Problem Statement: Calculate the factorial of a given number N.
Input Format:
Single integer N
Output Format:
Single integer (factorial of N)
Sample Input:
5
Sample Output:
120
QUESTION 20: Remove Duplicates from Sorted Array ⭐⭐
Difficulty: Easy | Frequency: 74% | Year: 2024
Problem Statement: Remove duplicates from a sorted array and print the unique elements.
Input Format:
First line: N (size of array)
Second line: N space-separated integers (sorted)
Output Format:
Unique elements space-separated
Sample Input:
7
1 1 2 2 3 4 4
Sample Output:
1 2 3 4
QUESTION 21: Find Missing Number (1 to N) ⭐⭐
Difficulty: Easy | Frequency: 80% | Year: 2024
Problem Statement: An array contains N-1 numbers taken from the range 1 to N. Find the missing number.
Input Format:
First line: N
Second line: N-1 space-separated integers
Output Format:
Single integer (missing number)
Sample Input:
5
1 2 4 5
Sample Output:
3
QUESTION 22: Count Set Bits ⭐⭐
Difficulty: Easy-Medium | Frequency: 65% | Year: 2024
Problem Statement: Count the number of set bits (1s) in the binary representation of a number.
Input Format:
Single integer N
Output Format:
Single integer (count of set bits)
Sample Input:
7
Sample Output:
3
Explanation:
7 in binary = 111 (three 1s)
QUESTION 23: Power of Two Check ⭐⭐
Difficulty: Easy | Frequency: 72% | Year: 2024
Problem Statement: Check if a given number is a power of 2.
Input Format:
Single integer N
Output Format:
"Yes" or "No"
Sample Input:
16
Sample Output:
Yes
QUESTION 24: Rotate Array by K Positions ⭐⭐⭐
Difficulty: Medium | Frequency: 68% | Year: 2024
Problem Statement: Rotate an array to the right by K positions.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Third line: K (number of rotations)
Output Format:
Rotated array space-separated
Sample Input:
5
1 2 3 4 5
2
Sample Output:
4 5 1 2 3
QUESTION 25: Maximum Subarray Sum (Kadane’s Algorithm) ⭐⭐⭐
Difficulty: Medium | Frequency: 70% | Year: 2024
Problem Statement: Find the contiguous subarray with the maximum sum.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Output Format:
Single integer (maximum sum)
Sample Input:
9
-2 1 -3 4 -1 2 1 -5 4
Sample Output:
6
Explanation:
Subarray [4, -1, 2, 1] has maximum sum = 6
QUESTION 26: Binary Search Implementation ⭐⭐
Difficulty: Easy-Medium | Frequency: 78% | Year: 2024
Problem Statement: Implement binary search to find the index of a target element in a sorted array. Return -1 if not found.
Input Format:
First line: N (size of array)
Second line: N space-separated integers (sorted)
Third line: target (element to search)
Output Format:
Index of target or -1
Sample Input:
7
2 5 8 12 16 23 38
23
Sample Output:
5
QUESTION 27: Count Frequency of Each Character ⭐⭐
Difficulty: Easy | Frequency: 82% | Year: 2024
Problem Statement: Count the frequency of each character in a string and print in order of appearance.
Input Format:
Single string
Output Format:
character-frequency pairs space-separated
Sample Input:
programming
Sample Output:
p-1 r-2 o-1 g-2 a-1 m-2 i-1 n-1
QUESTION 28: Merge Two Sorted Arrays ⭐⭐
Difficulty: Easy-Medium | Frequency: 74% | Year: 2024
Problem Statement: Merge two sorted arrays into a single sorted array.
Input Format:
First line: N1 (size of first array)
Second line: N1 space-separated integers (sorted)
Third line: N2 (size of second array)
Fourth line: N2 space-separated integers (sorted)
Output Format:
Merged sorted array space-separated
Sample Input:
3
1 3 5
3
2 4 6
Sample Output:
1 2 3 4 5 6
QUESTION 29: Find Equilibrium Index ⭐⭐⭐
Difficulty: Medium | Frequency: 66% | Year: 2024
Problem Statement: Find the equilibrium index where the sum of elements to the left equals the sum of elements to the right.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Output Format:
Index of equilibrium point or -1
Sample Input:
5
1 3 5 2 2
Sample Output:
2
Explanation:
At index 2: left sum (1+3=4) = right sum (2+2=4)
QUESTION 30: Longest Consecutive Sequence ⭐⭐⭐
Difficulty: Medium | Frequency: 62% | Year: 2024
Problem Statement: Find the length of the longest consecutive sequence in an unsorted array.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Output Format:
Single integer (length of longest sequence)
Sample Input:
6
100 4 200 1 3 2
Sample Output:
4
Explanation:
Longest consecutive sequence: 1, 2, 3, 4
QUESTION 31: Palindrome Check (Ignore Spaces & Case) ⭐⭐
Difficulty: Easy | Frequency: 88% | Year: 2023-2024
Problem Statement: Check if a given string is a palindrome, ignoring spaces, punctuation, and case.
Input Format:
Single string
Output Format:
"True" or "False"
Sample Input:
A man a plan a canal Panama
Sample Output:
True
QUESTION 32: Remove Vowels from String ⭐
Difficulty: Very Easy | Frequency: 76% | Year: 2024
Problem Statement: Remove all vowels (both uppercase and lowercase) from a string.
Input Format:
Single string
Output Format:
String without vowels
Sample Input:
Deloitte
Sample Output:
Dltt
QUESTION 33: Count Words in String ⭐
Difficulty: Very Easy | Frequency: 80% | Year: 2024
Problem Statement: Count the number of words in a string. Words are separated by spaces.
Input Format:
Single string
Output Format:
Single integer (word count)
Sample Input:
Welcome to Deloitte India
Sample Output:
4
QUESTION 34: Find Duplicate in Array ⭐⭐
Difficulty: Easy-Medium | Frequency: 70% | Year: 2024
Problem Statement: Find the first duplicate element in an array.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Output Format:
First duplicate element
Sample Input:
5
1 2 3 2 4
Sample Output:
2
QUESTION 35: Sort Array of 0s, 1s, and 2s (Dutch Flag) ⭐⭐⭐
Difficulty: Medium | Frequency: 64% | Year: 2024
Problem Statement: Sort an array containing only 0s, 1s, and 2s without using any sorting algorithm.
Input Format:
First line: N (size of array)
Second line: N space-separated integers (only 0, 1, 2)
Output Format:
Sorted array space-separated
Sample Input:
6
0 1 2 0 1 2
Sample Output:
0 0 1 1 2 2
QUESTION 36: Next Greater Element ⭐⭐⭐
Difficulty: Medium | Frequency: 68% | Year: 2024
Problem Statement: For each element in the array, find the next greater element on its right. If no greater element exists, print -1.
Input Format:
First line: N (size of array)
Second line: N space-separated integers
Output Format:
N space-separated integers (next greater elements)
Sample Input:
4
4 5 2 25
Sample Output:
5 25 25 -1
QUESTION 37: Print Diamond Pattern ⭐⭐⭐
Difficulty: Medium | Frequency: 58% | Year: 2024
Problem Statement: Print a diamond pattern using stars (*) for a given number N.
Input Format:
Single integer N
Output Format:
Diamond pattern with 2*N-1 rows
Sample Input:
5
Sample Output:
*
***
*****
*******
*********
*******
*****
***
*
QUESTION 38: Pascal’s Triangle ⭐⭐⭐
Difficulty: Medium | Frequency: 60% | Year: 2024
Problem Statement: Generate and print the first N rows of Pascal’s Triangle.
Input Format:
Single integer N
Output Format:
N rows of Pascal's Triangle
Sample Input:
5
Sample Output:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
QUESTION 39: Trapezium Pattern ⭐⭐⭐
Difficulty: Medium | Frequency: 55% | Year: 2024
Problem Statement: Print a trapezium pattern using stars (*) and dots (.) for a given number N.
Input Format:
Single integer N
Output Format:
Trapezium pattern
Sample Input:
3
Sample Output:
***..***
.**..**.
.******.
.**..**.
***..***
QUESTION 40: Spiral Matrix ⭐⭐⭐⭐
Difficulty: Hard | Frequency: 52% | Year: 2024
Problem Statement: Fill an N×N matrix in spiral order starting from 1.
Input Format:
Single integer N
Output Format:
N×N matrix filled in spiral order
Sample Input:
3
Sample Output:
1 2 3
8 9 4
7 6 5
QUESTION 41: Check Balanced Parentheses ⭐⭐⭐
Difficulty: Medium | Frequency: 72% | Year: 2024
Problem Statement: Check if an expression has balanced parentheses. The expression can contain ‘(‘, ‘)’, ‘[‘, ‘]’, ‘{‘, ‘}’.
Input Format:
Single string containing parentheses
Output Format:
"True" or "False"
Sample Input:
{[()()]}
Sample Output:
True
QUESTION 42: Longest Palindromic Substring ⭐⭐⭐⭐
Difficulty: Hard | Frequency: 48% | Year: 2024
Problem Statement: Find the longest palindromic substring in a given string.
Input Format:
Single string
Output Format:
Longest palindromic substring
Sample Input:
babad
Sample Output:
bab
Note: “aba” is also a valid answer
QUESTION 43: Trapping Rain Water ⭐⭐⭐⭐
Difficulty: Hard | Frequency: 45% | Year: 2024
Problem Statement: Given N non-negative integers representing an elevation map where the width of each bar is 1, compute how much water can be trapped after raining.
Input Format:
First line: N
Second line: N space-separated integers (heights)
Output Format:
Single integer (total water trapped)
Sample Input:
12
0 1 0 2 1 0 1 3 2 1 2 1
Sample Output:
6
QUESTION 44: Row with Maximum 1s in Binary Matrix ⭐⭐⭐
Difficulty: Medium | Frequency: 58% | Year: 2024
Problem Statement: Given a boolean 2D array where each row is sorted (all 0s before all 1s), find the row with the maximum number of 1s.
Input Format:
First line: M N (rows and columns)
Next M lines: N space-separated 0s and 1s
Output Format:
Row index (0-based) with maximum 1s
Sample Input:
4 4
0 1 1 1
0 0 1 1
1 1 1 1
0 0 0 0
Sample Output:
2
QUESTION 45: Generate All Permutations of String ⭐⭐⭐⭐
Difficulty: Hard | Frequency: 42% | Year: 2024
Problem Statement: Generate and print all permutations of a given string.
Input Format:
Single string
Output Format:
All permutations space-separated
Sample Input:
ABC
Sample Output:
ABC ACB BAC BCA CAB CBA
QUESTION 46: Longest Common Subsequence ⭐⭐⭐⭐
Difficulty: Hard | Frequency: 40% | Year: 2024
Problem Statement: Find the longest common subsequence between two strings. If multiple sequences have the same length, return the lexicographically smallest one.
Input Format:
Two lines with two strings
Output Format:
Longest common subsequence
Sample Input:
ABCD
BACD
Sample Output:
ACD
QUESTION 47: Class Monitor Selection Problem ⭐⭐⭐
Difficulty: Medium | Frequency: 65% | Year: 2024
Problem Statement: After JEE Mains, students got admission. The HOD maintains a register and updates the class monitor name whenever a student with better rank (lower number) visits. Count how many times the name was changed (cut) in the register.
Input Format:
First line: N (number of visits)
Second line: N space-separated ranks
Output Format:
Number of times name was cut
Sample Input:
6
4 3 7 2 6 1
Sample Output:
3
Explanation:
Initially rank 4, changed to rank 3 (1st cut),
then rank 2 (2nd cut), then rank 1 (3rd cut)
Total cuts = 3
QUESTION 48: Solar Rooftop Installation (Optimization) ⭐⭐⭐⭐
Difficulty: Hard | Frequency: 38% | Year: 2024
Problem Statement: There are N houses with different energy requirements. Two types of solar panels are available:
- Type X: Generates A units of energy, costs C1
- Type Y: Generates B units of energy, costs C2
Find the minimum cost to satisfy all energy requirements. Multiple panels can be installed on the same house.
Input Format:
First line: N (number of houses)
Second line: N space-separated integers (energy requirements)
Third line: A B C1 C2
Output Format:
Minimum total cost
Sample Input:
3
10 20 15
5 10 100 150
Sample Output:
550
QUESTION 49: Maximum Depth of Generic Tree ⭐⭐⭐⭐
Difficulty: Hard | Frequency: 35% | Year: 2024
Problem Statement: Given an acyclic graph (generic tree), find the maximum depth from the root node.
Input Format:
First line: N (number of nodes)
Next N-1 lines: u v (edge between u and v)
Last line: root (root node)
Output Format:
Single integer (maximum depth)
Sample Input:
5
1 2
1 3
2 4
2 5
1
Sample Output:
2
Explanation:
Tree structure:
1
/ \
2 3
/ \
4 5
Maximum depth from root = 2
QUESTION 50: Numbers with Exactly K Set Bits Less Than N ⭐⭐⭐⭐
Difficulty: Hard | Frequency: 32% | Year: 2024
Problem Statement: Count how many numbers less than N have exactly K set bits (1s) in their binary representation.
Input Format:
Two space-separated integers: N and K
Output Format:
Single integer (count of numbers)
Sample Input:
7 2
Sample Output:
3
Explanation:
Numbers less than 7 with exactly 2 set bits:
3 (binary: 11)
5 (binary: 101)
6 (binary: 110)
Total = 3
📊 FREQUENCY SUMMARY
| Frequency Range | Number of Questions | Difficulty |
|---|---|---|
| 90-98% | 5 questions | Easy-Medium |
| 80-89% | 8 questions | Easy-Medium |
| 70-79% | 10 questions | Easy-Medium |
| 60-69% | 9 questions | Medium |
| 50-59% | 7 questions | Medium |
| 40-49% | 6 questions | Medium-Hard |
| 30-39% | 5 questions | Hard |
Total: 50 Actual Deloitte Coding Questions (2020-2025)
Source: Verified from 1000+ Candidate Experiences
Platforms: GeeksforGeeks, PrepInsta, TechProgramMind, CCBP.in, HashedIn
Note: These are actual questions reported by candidates. Practice all questions thoroughly for best results in Deloitte NLA 2025.