Infosys Interview Experience — 7 Students | DSA, SQL, Projects & Technical Questions
7 Student Interview Experiences covering DSA, SQL, Core CS, projects, APIs, AWS, machine learning and resume-based questions.
Important: Interview questions can vary by candidate, resume and interview panel. The experiences below should be used for preparation and should not be treated as an official Infosys question paper.
Student 1 — Infosys Interview Experience
Duration: Around 1 hour
Interview format: 1-to-1 technical interview
I stepped in and had a little conversation with the interviewer and then the interview started.
- The interviewer did not ask for a long introduction and initially asked my name.
- The discussion gradually shifted to WingSpan.
- There were two coding problems, and I was asked to focus on solving one problem completely.
DSA — Greedy / Array Problem
Problem: Given array g containing children’s greed factors and array s containing cookie sizes.
A child i is satisfied only when:
- s[j] >= g[i]
- s[j] and g[i] have the same parity — both even or both odd.
- Each child receives at most one cookie.
Goal: Return the maximum number of content children.
Approach: Sort the children and cookies. While scanning the available cookies, ignore cookies that are too small or have the wrong parity. When a cookie can satisfy the current child, match them and move to the next child.
Why greedy works: For the smallest remaining child, using the smallest valid cookie avoids wasting a larger cookie that could potentially satisfy another child.
Complexity: Sorting takes O(n log n + m log m), followed by a linear scan of the arrays. Extra space depends on the sorting implementation.
Coding Explanation — Example
g = [1, 2, 3] and s = [2, 3, 4].
For child 1, cookie 3 can work because 3 >= 1 and both are odd. For child 2, cookie 2 or 4 can work because both are even. The same process continues while maintaining the parity condition.
The interviewer asked me not to jump to the next problem after solving one problem and asked me to explain the approach.
SQL — Second Highest Salary
Question: Find the second-highest salary from an employee table.
A robust approach is to use DENSE_RANK() when duplicate salary values should share the same rank:
SELECT salary
FROM (
SELECT salary,
DENSE_RANK() OVER (ORDER BY salary DESC) AS rnk
FROM Employee
) t
WHERE rnk = 2;
Follow-up: The interviewer may ask why DENSE_RANK is useful when multiple employees have the same salary. The answer is that equal salaries receive the same rank and the next distinct salary gets the next rank.
Resume & Machine Learning Discussion
- What are ACID properties?
- What is ROC-AUC?
- Difference between accuracy and ROC-AUC.
- A model achieves 0.98 accuracy locally but performs poorly in production. What could be the reasons?
- What is the vanishing-gradient problem?
- What are common solutions for vanishing gradients?
- Differentiate bagging and boosting.
- What is binary search and its time complexity?
- Do you know any software architecture or design pattern?
Additional Preparation Questions
- Why can accuracy be misleading on an imbalanced dataset?
- What is precision, recall and F1-score?
- What is overfitting and how can it be reduced?
- What is the difference between training, validation and test data?
Student 2 — Infosys Interview Experience
The interviewer asked me to start with my introduction and then asked about my projects — what they do, the tech stack, how they work and implementation details.
SQL — Customers Who Never Ordered
Two tables were provided:
- Customers(id, name, address)
- Orders(orderId, customerId, qty)
Question: Find all customers who have registered but have never placed any order.
SELECT c.id, c.name, c.address
FROM Customers c
LEFT JOIN Orders o
ON c.id = o.customerId
WHERE o.customerId IS NULL;
Explanation: A LEFT JOIN keeps every customer. If there is no matching order, the order-side columns become NULL. Filtering for NULL therefore gives customers with no orders.
DSA — Quick Sort
I was asked to perform a step-by-step dry run of Quick Sort and explain how the algorithm works.
Example: [7, 2, 9, 1, 5]
Choose a pivot, partition the array so that smaller values go to one side and larger values go to the other side, then recursively sort both partitions.
Average complexity: O(n log n).
Worst-case complexity: O(n²), for example when poor pivots repeatedly create highly unbalanced partitions.
quickSort(arr, low, high):
if low < high:
p = partition(arr, low, high)
quickSort(arr, low, p - 1)
quickSort(arr, p + 1, high)
WingSpan DSA — Pairing Problem
Problem: Given an array and a threshold value, select pairs of elements. Each pair contributes abs(arr[i] - arr[j]) to the total. Find the minimum number of pairs required to cross the threshold, with each array element usable only once.
The key discussion is how sorting and selecting suitable pairs can reduce unnecessary combinations. The interviewer asked me to explain the reasoning and complexity.
WingSpan DSA — Strict Elements
An element is considered strict if:
arr[i] > (previous element XOR next element)
The array is circular, so the previous element of the first position is the last element, and the next element of the last position is the first element.
SQL — Employee Salary vs Manager
Given Employee(id, name, salary, manager_id), find employees whose salary is greater than their manager’s salary.
SELECT e.name
FROM Employee e
JOIN Employee m
ON e.manager_id = m.id
WHERE e.salary > m.salary;
Core CS Questions
- What is an Operating System?
- Explain the TCP/IP model.
- What is DNS?
- Why do we need DNS?
- Can we access a website using its IP address?
- What is OOP?
- Explain the four pillars of OOP with real-world examples.
- What is Dependency Injection?
- What is the difference between a process and a thread?
- What is deadlock?
Project Discussion
- What does your project do?
- What problem does it solve?
- What technology stack did you use?
- How did you implement RAG?
- How does the overall architecture work?
- Why did you choose those technologies?
- How did you handle exceptions and API failures?
Student 3 — Infosys Interview Experience
I entered the interview and the interviewer directly started with a WingSpan coding problem.
DSA — Array + Modification
Given an array and an integer x, I could add x to any one element of the array. After adding x, I had to find the maximum sum of adjacent elements.
Example: arr = [1, 4, 2], x = 5
If 5 is added to the first element, the array becomes [6, 4, 2].
- 6 + 4 = 10
- 4 + 2 = 6
Therefore the maximum adjacent sum is 10 for that choice.
I solved it with a brute-force approach by trying every index, adding x temporarily and scanning adjacent pairs.
Time Complexity: O(n²)
Space Complexity: O(1)
Detailed Coding Explanation
answer = -infinity
for i from 0 to n-1:
arr[i] = arr[i] + x
current = maximum adjacent sum in arr
answer = max(answer, current)
arr[i] = arr[i] - x
return answer
The important point is restoring arr[i] after each trial so that the next iteration starts with the original array.
Project Discussion
The interviewer asked about one project and discussed its implementation and technologies.
SQL — 10th Highest Salary
Two tables, Emp1 and Emp2, contained employee name and salary. I was asked to join the tables and find the 10th-highest salary.
A ranking-based approach can be explained using:
SELECT salary
FROM (
SELECT salary,
DENSE_RANK() OVER (ORDER BY salary DESC) AS rnk
FROM Employee
) t
WHERE rnk = 10;
FastAPI / REST API / GraphQL
- What is FastAPI?
- What is a REST API?
- Difference between FastAPI and REST API.
- What is GraphQL?
- REST API vs GraphQL.
- Why was FastAPI used in your project?
- How do you validate request data?
- How do you handle HTTP errors?
AWS
- What is Amazon EC2?
- What is AWS Lambda?
- When would you choose Lambda instead of a continuously running server?
- How would an API communicate with a database in AWS?
Student 4 — Infosys Interview Experience
The discussion started with an introduction and then moved to DSA, SQL and project questions.
DSA — Sliding Window
Question: Given an array of positive integers and a target value, find the length of the smallest contiguous subarray whose sum is at least the target.
Example: arr = [2,3,1,2,4,3], target = 7.
The smallest valid subarray has length 2, for example [4,3].
Detailed Coding Explanation
Because all numbers are positive, expanding the right pointer can only increase the window sum, while moving the left pointer can only decrease it.
left = 0
sum = 0
answer = infinity
for right from 0 to n-1:
sum += arr[right]
while sum >= target:
answer = min(answer, right - left + 1)
sum -= arr[left]
left++
return answer
Time Complexity: O(n), because every element enters and leaves the window at most once.
Space Complexity: O(1).
Follow-up Questions
- Why does this approach fail if negative numbers are allowed?
- What is the difference between sliding window and two pointers?
- Can the same problem be solved using prefix sums?
- What changes if the array is circular?
SQL — Salary Above Department Average
SELECT e.name, e.salary, e.department_id
FROM Employee e
JOIN (
SELECT department_id, AVG(salary) AS avg_salary
FROM Employee
GROUP BY department_id
) d
ON e.department_id = d.department_id
WHERE e.salary > d.avg_salary;
Project Discussion
- Explain your architecture.
- What was your contribution?
- Which APIs did you use?
- How did you handle errors?
- How did you test the application?
- How did you design the database?
- What happens when the API server is unavailable?
Student 5 — Infosys Interview Experience
The interviewer started with technical questions and then moved toward DSA, database concepts and project discussion.
DSA — Bit Manipulation
Question: Every element in an array appears twice except one element. Find the element that appears once.
Example: [4, 1, 2, 1, 2] → answer = 4.
The XOR operation is useful because:
a XOR a = 0a XOR 0 = a- XOR is commutative and associative.
answer = 0
for value in arr:
answer = answer XOR value
return answer
Every duplicate cancels out, leaving only the unique element.
Time Complexity: O(n)
Space Complexity: O(1)
Bit Manipulation Follow-ups
- How do you check whether a number is even using bits?
- How do you check whether the k-th bit is set?
- What is the difference between left shift and right shift?
- How can XOR be used to swap values conceptually?
Normal Dynamic Programming
A standard DP problem was discussed where the current answer depends on previously computed states.
What to explain in an interview:
- Define the state.
- Write the recurrence.
- Identify the base cases.
- Explain the order in which states are calculated.
- Discuss time and space complexity.
Preparation example — Climbing Stairs: If you can climb either one or two steps, then:
dp[i] = dp[i-1] + dp[i-2]
with base cases such as dp[0] = 1 and dp[1] = 1. This can be optimized to O(1) space by keeping only the previous two values.
SQL & DBMS
- Primary key vs foreign key.
- What is normalization?
- What is a view?
- What are ACID properties?
- What is an index?
- When can an index improve query performance?
Project Questions
- How did you design the project?
- How does data flow through the system?
- Why did you select these technologies?
- What was the most difficult implementation problem?
- How would you scale the project?
Student 6 — Infosys Interview Experience
The interview started with an introduction and project discussion, followed by DSA, Core CS and SQL.
DSA — Greedy Interval Problem
Question: Given a set of intervals, select the maximum number of non-overlapping intervals.
Example: [1,3], [2,4], [3,5], [5,7].
The standard greedy strategy is to sort intervals by their ending time and repeatedly select the next interval whose start is at least the end of the previously selected interval.
sort intervals by ending time
count = 0
lastEnd = -infinity
for interval in intervals:
if interval.start >= lastEnd:
select interval
count++
lastEnd = interval.end
return count
Why greedy? Choosing the interval that finishes earliest leaves the largest possible remaining range for future intervals.
Complexity: O(n log n) because of sorting, followed by O(n) scanning.
Core CS Questions
- Process vs thread.
- What is deadlock?
- What are the four necessary conditions for deadlock?
- What is inheritance?
- What is polymorphism?
- What is abstraction?
- What is encapsulation?
- What is virtual memory?
SQL
I was asked to use GROUP BY and HAVING to filter grouped records using an aggregate condition.
SELECT department_id, COUNT(*) AS employee_count
FROM Employee
GROUP BY department_id
HAVING COUNT(*) > 5;
The interviewer can follow up by asking the difference between WHERE and HAVING. WHERE filters rows before grouping; HAVING filters groups after aggregation.
Project Discussion
- Explain the database design.
- Explain the API flow.
- How did you authenticate users?
- How did you handle invalid input?
- How would you improve performance?
Student 7 — Infosys Interview Experience
The interview began with an introduction and questions around the projects mentioned on the resume. The discussion then moved to coding, SQL and implementation concepts.
DSA — Dynamic Programming
I was given a standard dynamic-programming problem where the objective was to maximize the value obtained by making choices from an array under a constraint.
I first explained the brute-force recursive idea and then converted it into DP by defining the state, recurrence and base cases.
Detailed DP Interview Explanation
A good way to explain a DP solution is:
- State: What does
dp[i]represent? - Transition: How is
dp[i]calculated from earlier states? - Base case: What are the smallest valid inputs?
- Order: In what sequence should states be calculated?
- Complexity: How much time and memory are required?
Preparation example — House Robber: At each house, choose between skipping the current house or taking it and adding its value to the best answer two positions earlier.
dp[i] = max(dp[i-1], dp[i-2] + nums[i])
The space can then be optimized because only the previous two states are required.
SQL — Employee Salary vs Manager
Given:
Emp(id, name, salary, manager_id)
Question: Return all employees whose salary is greater than their manager’s salary.
SELECT e.id, e.name, e.salary
FROM Emp e
JOIN Emp m
ON e.manager_id = m.id
WHERE e.salary > m.salary;
This is a self join because the employee and manager are stored in the same table.
Java / Backend Questions
- How do you create a REST API?
- How do you handle exceptions?
- How does file handling work in Java?
- What alternatives exist for exception handling?
- What is the difference between checked and unchecked exceptions?
- What is the difference between GET, POST, PUT and DELETE?
Database Follow-ups
- What is a view?
- How do you create a primary key?
- How can you ensure manager_id refers to an employee in the same table?
- What is a foreign key?
- What is a self-referencing foreign key?
Final Project Discussion
- What does the project do?
- What problem does it solve?
- Explain the complete architecture.
- How does the frontend communicate with the backend?
- How is data stored?
- What happens if an API request fails?
- How would you scale the project for more users?
Most Important Topics to Prepare
DSA: Greedy, Bit Manipulation, Sliding Window, Arrays, Sorting, Binary Search and Normal Dynamic Programming.
SQL: Joins, Self Joins, Second/10th Highest Salary, GROUP BY, HAVING, Subqueries, Window Functions and Manager-Employee queries.
Core CS: OOP, OS, Processes, Threads, Deadlock, TCP/IP, DNS, DBMS, ACID and Dependency Injection.
Projects: Be ready to explain every technology, API, database, architecture decision and implementation detail written on your resume.
Final Preparation Tip: Do not only memorize solutions. During the interview, explain your approach, why it works, edge cases, time complexity, space complexity and possible optimizations.
Disclaimer: Interview questions can vary between candidates and interview panels. This article is intended for preparation and does not represent an official Infosys question list.


