Infosys System Engineer – 50 Coding Problems
(Fresher Prep)
Easy (Basics, must-know)
1 Swap two numbers (with / without third variable)
2 Reverse a string without using built-in functions
3 Check if a string is a palindrome
4 Print Fibonacci sequence up to n terms
5 Factorial of a number (iterative & recursive)
6 Check whether a number is prime
7 Find GCD and LCM of two numbers
8 Convert decimal number to binary
9 Convert decimal number to octal / hex
10 Armstrong number check
11 Count vowels and consonants in a string
12 Find largest and smallest number in an array
13 Sum of digits of a number
14 Reverse a number
15 Print multiplication table of n
Easy → Medium (String / Array Focus)
1 First non-repeating character in a string
2 Check if two strings are anagrams
3 Remove all duplicates from a string
4 Remove spaces from a string
5 Find frequency of each character in a string
6 Sort characters in a string alphabetically
7 Remove duplicates from sorted array
8 Find missing number in array of 1…n
9 Find second largest element in array
10 Merge two sorted arrays
11 Find subarray with maximum sum (Kadane’s Algorithm)
12 Left rotate an array by k positions
13 Search element in sorted array (Binary Search)
14 Check if array is sorted
15 Count occurrences of an element in array
Medium (Mathematics + Puzzles)
1 Check if a number is power of 2
2 Generate Pascal’s Triangle
3 Print prime numbers up to n
4 Sum of all prime numbers between 1 and n
5 Print 1 to n without using loops (recursion)
6 Find middle of three numbers
7 Check if string is rotation of another (by 2 places)
8 Calculate area of rectangle / circle / triangle
9 Matrix addition
10 Matrix multiplication
Medium → Hard (Interview-level)
1 Implement Stack using Arrays
2 Implement Queue using Arrays
3 Balanced Parentheses problem (valid brackets check)
4 Find majority element in an array (> n/2 times)
5 Longest common prefix among strings
6 Longest increasing subsequence
7 Minimum number of jumps to reach end of array
8 Job sequencing problem (greedy)
9 Next permutation of an array
10 Minimum number of platforms required (railway scheduling)