How to Crack Infosys Coding Interviews in 2026
Complete guide to Infosys coding interviews — question patterns, difficulty breakdown, must-practice topics, and preparation strategy.
Infosys is one of India's largest IT services companies and a significant global employer of software engineers. The company hires at massive scale — especially through their InfyTQ platform for freshers and the Infosys Specialist Programmer (SP) and Digital Specialist Engineer (DSE) tracks for more advanced roles. What distinguishes Infosys from similarly large service companies is that their SP and DSE roles have a notably higher coding bar, with problem difficulty approaching that of product companies.
For fresher hiring, the process typically involves the InfyTQ certification exam, a coding round on HackWithInfy, and a technical plus HR interview. For the SP track, the coding challenges are significantly harder. Lateral hires face technical screening, one or two coding rounds, and a managerial interview. The coding expectations scale with the role level.
By the Numbers
Infosys has 158 questions in the CodeJeet database, with a difficulty profile that is more demanding than you might expect:
- Easy: 42 questions (27%) — About a quarter of the pool. A reasonable warmup set, but Infosys is not purely a basics-testing company.
- Medium: 82 questions (52%) — The largest segment. Medium problems dominate the interview experience.
- Hard: 34 questions (21%) — One in five questions is Hard. This is a higher ratio than companies like TCS, IBM, or Accenture, and reflects the SP/DSE track difficulty.
The 27/52/21 split may surprise candidates who assume IT services companies are easy. If you are targeting the Specialist Programmer role, expect to face problems that are genuinely challenging.
Top Topics to Focus On
Array — As with most companies, arrays lead the pack. Infosys array problems include standard fare like subarray sums and rotations, but also more involved problems like trapping rain water and jump game variants on the SP track. A deep understanding of two-pointer techniques, sliding windows, and prefix sums is crucial.
# Example: Kadane's Algorithm for Maximum Subarray Sum (Array)
def max_subarray_sum(nums):
max_current = max_global = nums[0]
for i in range(1, len(nums)):
max_current = max(nums[i], max_current + nums[i])
if max_current > max_global:
max_global = max_current
return max_global
# Example usage
print(max_subarray_sum([-2,1,-3,4,-1,2,1,-5,4])) # Output: 6
Dynamic Programming — This is where Infosys stands apart from its services-company peers. DP is the second most common topic, and it is heavily represented in the Hard tier. Expect problems involving sequences, grids, string matching, and optimization. If you are targeting the SP or DSE role, DP proficiency is essential. You must be comfortable with both top-down (memoization) and bottom-up (tabulation) approaches.
# Example: Bottom-up DP for Fibonacci (Dynamic Programming)
def fibonacci_bottom_up(n):
if n <= 1:
return n
dp = [0] * (n + 1)
dp[1] = 1
for i in range(2, n + 1):
dp[i] = dp[i-1] + dp[i-2]
return dp[n]
# Example usage
print(fibonacci_bottom_up(10)) # Output: 55
String — String processing, pattern matching, and encoding problems. Infosys string questions range from straightforward Easy problems to Medium-level challenges that combine string manipulation with hash maps or DP. Common tasks include checking for palindromes, anagrams, and substring problems.
# Example: Check if a string is a palindrome (String)
def is_palindrome(s):
left, right = 0, len(s) - 1
while left < right:
if s[left] != s[right]:
return False
left += 1
right -= 1
return True
# Example usage
print(is_palindrome("racecar")) # Output: True
print(is_palindrome("hello")) # Output: False
Math — Number theory, combinatorics, and mathematical reasoning problems appear more frequently at Infosys than at most product companies. GCD, prime factorization, modular exponentiation, and digit-based problems are common, especially in the online assessment rounds. Efficient algorithms for prime checking and modular arithmetic are essential.
# Example: Euclidean Algorithm for GCD (Math)
def gcd(a, b):
while b:
a, b = b, a % b
return a
# Example: Sieve of Eratosthenes for primes up to n
def sieve_of_eratosthenes(n):
is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False
p = 2
while p * p <= n:
if is_prime[p]:
for i in range(p * p, n + 1, p):
is_prime[i] = False
p += 1
primes = [i for i, prime in enumerate(is_prime) if prime]
return primes
# Example usage
print(gcd(48, 18)) # Output: 6
print(sieve_of_eratosthenes(30)) # Output: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
Hash Table — The standard hash map patterns: frequency counting, two-sum variants, and group-by operations. Hash tables serve as the bridge between brute-force and optimal solutions for many Infosys problems. Mastering the use of dictionaries (Python), objects/Maps (JavaScript), and HashMaps (Java) is fundamental.
# Example: Two Sum using Hash Table
def two_sum(nums, target):
num_map = {}
for i, num in enumerate(nums):
complement = target - num
if complement in num_map:
return [num_map[complement], i]
num_map[num] = i
return []
# Example usage
print(two_sum([2, 7, 11, 15], 9)) # Output: [0, 1]
Preparation Strategy
Weeks 1-2: Build Your Base
Start with Easy problems in arrays, strings, and math. Solve 4 to 5 per day. Pay special attention to math problems — Infosys tests mathematical thinking more than most companies, and these problems are easy points once you have the techniques down. Familiarize yourself with modular arithmetic and prime number algorithms. Practice writing clean, efficient code for basic operations like array traversal, string reversal, and calculating factorial or Fibonacci numbers.
Weeks 3-4: Medium Problems and DP Foundations
Transition to Medium-difficulty problems. Spend half your time on arrays and strings, and half on dynamic programming. For DP, start with 1D problems (fibonacci variants, climbing stairs, house robber) and progress to 2D problems (unique paths, edit distance, longest common subsequence). Aim for 2 to 3 problems per day. Always define the DP state and recurrence before coding. Practice both recursive memoization and iterative tabulation for each problem to build flexibility.
# Example: Climbing Stairs (DP - 1D)
def climb_stairs(n):
if n <= 2:
return n
dp = [0] * (n + 1)
dp[1], dp[2] = 1, 2
for i in range(3, n + 1):
dp[i] = dp[i-1] + dp[i-2]
return dp[n]
# Example usage
print(climb_stairs(5)) # Output: 8
Week 5: Hard Problems and SP-Track Preparation
If you are targeting the Specialist Programmer role, this week is critical. Tackle 10 to 12 Hard problems, prioritizing DP and array-based challenges. Practice problems from competitive programming platforms to build speed. For the HackWithInfy competition, familiarize yourself with the contest format and time constraints. Focus on complex DP problems like knapsack variations, matrix chain multiplication, and DP on trees or graphs.
# Example: 0/1 Knapsack Problem (DP - Hard)
def knapsack(weights, values, capacity):
n = len(weights)
dp = [[0] * (capacity + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
for w in range(1, capacity + 1):
if weights[i-1] <= w:
dp[i][w] = max(values[i-1] + dp[i-1][w - weights[i-1]], dp[i-1][w])
else:
dp[i][w] = dp[i-1][w]
return dp[n][capacity]
# Example usage
weights = [1, 3, 4, 5]
values = [1, 4, 5, 7]
capacity = 7
print(knapsack(weights, values, capacity)) # Output: 9
Week 6: Mock Tests and Weak-Area Review
Simulate the HackWithInfy format: 3 hours, 3 problems of increasing difficulty. Run at least two full simulations. Identify your weakest area — if it is DP, spend extra time on state definition and tabulation approaches. If it is math, drill number theory problems. Reserve the last two days for a relaxed review of all major patterns. Practice input/output handling for large datasets, as platform performance matters.
Key Tips
-
Differentiate your preparation by role. The coding bar for a generic Infosys hire is very different from the Specialist Programmer or DSE track. If you are aiming for SP, prepare as you would for a product company — solve Hard problems, study DP thoroughly, and practice competitive programming. For lateral hires, expect system design questions alongside coding.
-
Take HackWithInfy seriously. Infosys uses this competition to identify top candidates for the SP role, which comes with a significantly higher starting package. Top performers in HackWithInfy are fast-tracked through the hiring process. Treat it like a competitive programming contest, not a casual assessment. Practice under timed conditions and learn to quickly identify problem patterns.
-
Do not skip math. Unlike at Google or Meta, where math problems are rare, Infosys explicitly tests mathematical reasoning. Practice GCD algorithms, sieve of Eratosthenes, and problems involving digits and modular arithmetic. These are predictable and scorable if you have practiced. Understand concepts like modular inverse and fast exponentiation.
-
Master bottom-up DP. While top-down memoization is conceptually easier, Infosys problems often have tight time limits that favor iterative (bottom-up) DP implementations. Practice converting recursive DP solutions to tabulation form. This also helps avoid recursion depth limits for large inputs.
-
Prepare for platform-specific nuances. The HackWithInfy platform has its own interface and judge behavior. Practice on similar platforms to get comfortable with input parsing, time limit expectations, and partial scoring. Know how your language handles large inputs and outputs efficiently. For example, in Java, use
BufferedReaderandStringBuilderfor fast I/O.
# Example: Fast Input Reading in Python for large inputs
import sys
def read_large_input():
# Read all lines at once for efficiency
data = sys.stdin.read().strip().split()
# Process data as integers
nums = list(map(int, data))
return nums
# Simulating large input processing
if __name__ == "__main__":
# In a contest, you would read from sys.stdin
# For demonstration, we simulate with a list
simulated_input = "100000\n" + "1 " * 100000
import io
sys.stdin = io.StringIO(simulated_input)
numbers = read_large_input()
print(f"Read {len(numbers)} numbers")