π» 2026 MNC Placement Coding & DSA Master Guide
Top 50 Coding Questions for TCS, Infosys & Accenture Placements 2026
π― Official 2026 Direct Technical Answer
Technical coding assessments for TCS NQT, Infosys DSE/SP, and Accenture in 2026 focus on arrays, string manipulation, two-pointer techniques, hash maps, recursion, and basic dynamic programming. Mastering time complexity constraints (O(N) vs O(N^2)) is mandatory to pass all hidden test cases within allotted test timers.
π Top Repeated MNC Placement Coding Patterns Matrix
| Algorithm Pattern | High-Frequency Problem | Optimal Time Complexity | Target MNC Companies |
|---|---|---|---|
| Two Pointers | Two Sum in Sorted Array / Pair with Target Difference | O(N) time, O(1) space | TCS NQT, Infosys, Cognizant |
| Hash Map Frequency | First Non-Repeating Character in a String | O(N) time, O(1) space (26 chars) | Accenture, Wipro, Capgemini |
| Array Manipulation | Trapping Rain Water / Maximum Subarray Sum (Kadane's) | O(N) time, O(1) space | Infosys SP, TCS Digital, LTIMindtree |
| String Sliding Window | Longest Substring Without Repeating Characters | O(N) time, O(min(N, M)) space | Accenture, TCS Prime, Cognizant GenC Next |
| Dynamic Programming | 0/1 Knapsack & Climb Stairs Problem | O(N) time, O(N) space | Infosys DSE, TCS Digital, Persistent Systems |
β‘ Live 2026 Interactive Tool
2026 IT Certification Cost & 18% GST Calculator
Calculate exact Pearson VUE exam fees in INR, 18% GST tax breakdown, USD exchange rates & student voucher savings.
π» Technical Scenarios, Code & Solutions
Question 1
Provide optimal Python and Java solutions for Kadane's Algorithm (Maximum Subarray Sum).
Kadane's algorithm finds the contiguous subarray with the largest sum in O(N) linear time:
Python Solution:
Java Solution:
Python Solution:
def max_subarray_sum(nums):
max_so_far = nums[0]
current_max = nums[0]
for x in nums[1:]:
current_max = max(x, current_max + x)
max_so_far = max(max_so_far, current_max)
return max_so_far
print(max_subarray_sum([-2, 1, -3, 4, -1, 2, 1, -5, 4])) # Output: 6Java Solution:
public static int maxSubArray(int[] nums) {
int maxSoFar = nums[0];
int currentMax = nums[0];
for (int i = 1; i < nums.length; i++) {
currentMax = Math.max(nums[i], currentMax + nums[i]);
maxSoFar = Math.max(maxSoFar, currentMax);
}
return maxSoFar;
}
Question 2
How do you detect a cycle in a Linked List using Floyd's Tortoise and Hare algorithm?
Use two pointers moving at different speeds (slow moves 1 step; fast moves 2 steps). If a cycle exists, the fast pointer will eventually catch up and meet the slow pointer in O(N) time and O(1) space.
β Frequently Asked Technical Questions
Curated by senior corporate mentors and technical hiring leads.
What coding language is best for TCS NQT and Infosys?
Python and Java are the most popular; Java has faster execution speeds while Python allows faster syntax authoring.
How many coding questions appear in TCS NQT?
Typically 2 coding questions: 1 basic/intermediate (15 mins) and 1 advanced DSA problem (30 mins).
What causes a Time Limit Exceeded (TLE) error in online platforms?
Using an O(N^2) nested loop when input constraints (N <= 10^5) require an O(N) or O(N log N) algorithm.
Are built-in library functions allowed in MNC coding rounds?
Yes, standard libraries like Python collections/sort or Java Arrays/Collections are permitted unless the question explicitly forbids them.
What is the difference between TCS Ninja and TCS Digital/Prime?
Ninja packages are ~βΉ3.6 LPA with basic coding; Digital and Prime packages range from βΉ7.0 to βΉ9.0 LPA with advanced DSA requirements.
How do you handle edge cases in coding tests?
Always test empty arrays, single-element inputs, negative integers, duplicate values, and maximum integer constraints.
What is space complexity?
The amount of memory an algorithm consumes relative to input size, excluding the space taken by the inputs themselves.
Does 4Achievers offer company-specific mock placement drives?
Yes, 4Achievers runs intensive placement drives covering TCS NQT, Infosys, and Accenture with live compiler simulators.
Master Placement Coding with 1-on-1 Senior Mentorship
Enroll in 4Achievers live mentor-led batches with 24/7 cloud sandbox access, real-world portfolio capstones, and direct interview placement prep.