Tech Mahindra tests coding in the Automata Fix format: 2 problems in 45 minutes, where roughly 70% of the code is pre-written and you fix the logic, correct a bug or complete a function — in C, C++, Java or Python. Solutions run against hidden test cases, and partial credit is possible.
What Automata Fix problems look like
Problems are short array/string tasks: counting under a rule, running sums with a condition, frequency maps, and simple sliding scans. The three problems below are rebuilt from recent memory-based Tech Mahindra papers — try them before opening the solutions, then compare in your preferred language.
You are given an array where each element is the length (in feet) of a piece of cloth. A standard clothing piece requires exactly 10 feet of cloth. Write a program to find the total number of standard 10-foot pieces that can be cut from all the cloth pieces combined. Leftover cloth shorter than 10 feet from any piece is wasted.
Input: lengths = [5, 10, 40]
Output: 5
5 ft gives 0 pieces, 10 ft gives 1 piece, 40 ft gives 4 pieces → 0 + 1 + 4 = 5.
Input: lengths = [9, 19, 28]
Output: 3
0 + 1 + 2 = 3 pieces; the leftovers (9, 9 and 8 ft) are wasted.
- 1 ≤ n ≤ 10⁵
- 1 ≤ lengths[i] ≤ 10⁴
Given an array of positive integers, return the difference between the sum of its odd numbers and the sum of its even numbers (odd sum minus even sum).
Input: arr = [13, 8, 9, 4]
Output: 10
(13 + 9) − (8 + 4) = 22 − 12 = 10.
Input: arr = [2, 4, 6]
Output: -12
There are no odd numbers, so the answer is 0 − 12 = −12.
- 1 ≤ n ≤ 10⁵
- 1 ≤ arr[i] ≤ 10⁹
Given a string of lowercase English letters, find the length of the longest “good” substring. A substring is good when every pair of consecutive characters is in ascending order with a difference of exactly 1 (for example, “abc” or “pqrs”). A single character is always good.
Input: s = "abcpqrsxy"
Output: 4
“abc” has length 3, “pqrs” has length 4, “xy” has length 2 — the longest is 4.
Input: s = "zzz"
Output: 1
No two consecutive characters differ by exactly +1, so the best is a single character.
- 1 ≤ |s| ≤ 10⁵
- s contains only lowercase English letters
How to prepare for Automata Fix
- Practice reading code first: most Automata Fix marks are lost misunderstanding the skeleton, not writing new logic.
- Master one language's I/O and syntax cold — a missed semicolon costs compile marks under time pressure.
- Drill the standard toolbox: integer division and modulo, running min/max, frequency counting, single-pass scans.
- Always test the given example before submitting — hidden cases usually add only edge sizes and boundaries.
Strong performance here can earn a SuperCoder challenge invitation (~₹5.5 LPA). For the MCQ half of the round, see Technical Questions.

