Online assessment
Maruti Suzuki Coding Questions
Overview
Practice Maruti Suzuki coding questions in the style students report for online assessments and technical interviews. Focus areas: Aptitude, mechanical/auto basics, GD. Languages commonly allowed: C/C++ for electronics tracks.
Maruti Suzuki coding pattern
| Item | Typical expectation |
|---|---|
| Problems | 1-3 coding tasks depending on drive |
| Skills | Aptitude, mechanical/auto basics, GD |
| Languages | C/C++ for electronics tracks (use what the assessment email lists) |
| What matters | Correctness first, then speed and clear code |
Practice problems
Question 1: longest substring without repeating characters
Coding Q1: Longest substring without repeating characters
Problem: Given a string s, find the length of the longest substring without repeating characters. Example: ‘abcabcbb’ → 3 (‘abc’).
Approach: Sliding window with a map (or last-seen index) of characters. Expand the right pointer; when a duplicate appears inside the window, move the left pointer past the previous occurrence.
Complexity: O(n) time
Maruti Suzuki tip: Restate the problem, sketch a brute-force idea, then tighten it. Call out edge cases (empty input, single element, overflow) before you write code.
Question 2: merge overlapping intervals
Coding Q2: Merge overlapping intervals
Problem: Given a list of intervals [start, end], merge all overlapping intervals and return the non-overlapping set that covers the same ranges.
Approach: Sort by start time. Walk once, merging into the last interval in the result when the next start is ≤ current end; otherwise append a new interval.
Complexity: O(n log n) time from the sort
Maruti Suzuki tip: Restate the problem, sketch a brute-force idea, then tighten it. Call out edge cases (empty input, single element, overflow) before you write code.
Question 3: top k frequent elements
Coding Q3: Top K frequent elements
Problem: Given an integer array and an integer k, return the k most frequent elements. Order among equals can be arbitrary unless the problem says otherwise.
Approach: Count frequencies with a hash map, then use a heap of size k (or bucket sort by frequency) to extract the top k keys.
Complexity: O(n log k) with a heap
Maruti Suzuki tip: Restate the problem, sketch a brute-force idea, then tighten it. Call out edge cases (empty input, single element, overflow) before you write code.
Question 4: linked list cycle
Coding Q4: Linked list cycle
Problem: Given the head of a linked list, return true if there is a cycle and false otherwise.
Approach: Floyd’s tortoise and hare: move one pointer one step and another two steps. If they meet, a cycle exists. If the fast pointer hits null, there is no cycle.
Complexity: O(n) time, O(1) space
Maruti Suzuki tip: Restate the problem, sketch a brute-force idea, then tighten it. Call out edge cases (empty input, single element, overflow) before you write code.
Question 5: binary tree level order
Coding Q5: Binary tree level order
Problem: Given the root of a binary tree, return the level-order traversal (breadth-first) as a list of levels.
Approach: Use a queue. For each level, drain the current queue size, collect values, and enqueue children for the next level.
Complexity: O(n) time, O(n) space
Maruti Suzuki tip: Restate the problem, sketch a brute-force idea, then tighten it. Call out edge cases (empty input, single element, overflow) before you write code.
Question 6: coin change
Coding Q6: Coin change (min coins)
Problem: Given coin denominations and an amount, return the fewest coins needed to make that amount, or -1 if it is impossible.
Approach: Unbounded knapsack DP: let dp[x] be the minimum coins for amount x. For each coin, update dp[c..amount]. Initialize dp[0] = 0 and the rest to a large sentinel.
Complexity: O(amount × coins)
Maruti Suzuki tip: Restate the problem, sketch a brute-force idea, then tighten it. Call out edge cases (empty input, single element, overflow) before you write code.
Question 7: binary search
Coding Q7: Binary search
Problem: Given a sorted array of distinct integers and a target, return the index of target or -1 if missing.
Approach: Maintain lo/hi. Compare mid with target and shrink the half that cannot contain it. Careful with overflow-free mid and empty arrays.
Complexity: O(log n) time
Maruti Suzuki tip: Restate the problem, sketch a brute-force idea, then tighten it. Call out edge cases (empty input, single element, overflow) before you write code.
Question 8: move zeros
Coding Q8: Move zeros
Problem: Move all zeros in an array to the end while keeping the relative order of non-zero elements.
Approach: Two pointers: write non-zeros toward the front, then fill the remainder with zeros. Or swap zeros as you scan.
Complexity: O(n) time, O(1) space
Maruti Suzuki tip: Restate the problem, sketch a brute-force idea, then tighten it. Call out edge cases (empty input, single element, overflow) before you write code.
Question 9: rotate array
Coding Q9: Rotate array
Problem: Rotate an array to the right by k steps. Example: [1,2,3,4,5,6,7], k = 3 → [5,6,7,1,2,3,4].
Approach: Normalize k %= n. Reverse the whole array, reverse the first k elements, then reverse the rest. That yields the rotation in place.
Complexity: O(n) time, O(1) space
Maruti Suzuki tip: Restate the problem, sketch a brute-force idea, then tighten it. Call out edge cases (empty input, single element, overflow) before you write code.
Question 10: first unique character
Coding Q10: First unique character
Problem: Find the first non-repeating character in a string and return its index, or -1 if none exists.
Approach: Count frequencies in one pass (hash map or array of 26 for lowercase). Second pass returns the first index with count 1.
Complexity: O(n) time
Maruti Suzuki tip: Restate the problem, sketch a brute-force idea, then tighten it. Call out edge cases (empty input, single element, overflow) before you write code.
Pattern drill plan (2 weeks)
| Day | Drill |
|---|---|
| Mon | Arrays + hashing (2 problems) |
| Tue | Two pointers / sliding window |
| Wed | Stacks / strings |
| Thu | Trees or graphs basics |
| Fri | Timed mock (1-2 problems) |
| Sat | Re-solve misses cold |
| Sun | Explain your project out loud + rest |
Comments & Suggestions
Related
Similar companies
Tata Motors · Mahindra · Bosch

