Placement Prep

AMCAT Automata Question Bank Set 1: Practice and Solutions

Two AMCAT Automata practice problems solved step by step: Cell Competition Simulation and Maze Pathfinding, with verified C++ code and placement prep patterns.

By FACE Prep Team 8 min read
amcat automata coding-test placement-prep arrays graph-algorithms

The AMCAT Automata section gives you two coding problems and roughly 30 minutes to solve them. The automated grader scores your submission on four axes: correctness, time complexity, runtime error handling, and approach quality.

This article works through two practice problems from the AMCAT Automata question bank. Both are solved end-to-end, with verified traces and explanations of the patterns they test. If you need the broader test structure first, AMCAT Automata: Questions, Answers, and Scoring Criteria covers the full format and grading rubric.


What the AMCAT Automata Section Measures

SHL India, which runs the AMCAT through the Automata 2.0 platform, grades your code against three tiers of test cases: basic, advanced, and boundary. A solution that passes only the visible sample cases scores lower than one that handles edge cases correctly.

ParameterDetail
Number of questions2 (one easy, one hard; order varies by session)
Time limitapproximately 30 minutes for both questions
Languages supportedC, C++, Java, Python
Grading axescorrectness, time complexity, runtime errors, approach quality

The grading criteria matter more than most students expect. Two students can both write code that compiles and runs, but the one whose solution handles boundary conditions and runs in linear time will outscore the other. The AMCAT official portal publishes sample rubrics and test patterns that show how scoring breaks down per question type.

The two problems in this set represent distinct algorithmic patterns: state simulation on a linear array, and graph traversal on a 2D grid. Both patterns recur throughout the AMCAT Automata question bank with different surface-level details.


Problem 1: Cell Competition Simulation

Problem Statement

A colony of 8 cells is arranged in a straight line, numbered 0 through 7. Each cell is either active (1) or inactive (0). Every day, all cells update simultaneously by this rule:

  • If both neighbours are in the same state (both 1 or both 0), the cell becomes 0.
  • If the neighbours are in different states, the cell becomes 1.
  • The cells at positions 0 and 7 treat the cell beyond their edge as always 0.

Write a function cellCompete(int* cells, int days) that returns the final state array after the given number of days.

Step-by-Step Trace: Example 1

Input: [1, 0, 0, 0, 0, 1, 0, 0], 1 day

  • Cell 0: left = 0 (boundary), right = 0 (cells[1]); same; result: 0
  • Cell 1: left = 1 (cells[0]), right = 0 (cells[2]); different; result: 1
  • Cell 2: left = 0 (cells[1]), right = 0 (cells[3]); same; result: 0
  • Cell 3: left = 0 (cells[2]), right = 0 (cells[4]); same; result: 0
  • Cell 4: left = 0 (cells[3]), right = 1 (cells[5]); different; result: 1
  • Cell 5: left = 0 (cells[4]), right = 0 (cells[6]); same; result: 0
  • Cell 6: left = 1 (cells[5]), right = 0 (cells[7]); different; result: 1
  • Cell 7: left = 0 (cells[6]), right = 0 (boundary); same; result: 0
  • Output after 1 day: [0, 1, 0, 0, 1, 0, 1, 0] (verified correct)

Step-by-Step Trace: Example 2

Input: [1, 1, 1, 0, 1, 1, 1, 1], 2 days

Day 1 result (derived from input above, same rule applied):

  • Cell 0: left=0, right=1; different; 1
  • Cell 1: left=1, right=1; same; 0
  • Cell 2: left=1, right=0; different; 1
  • Cell 3: left=1, right=1; same; 0
  • Cell 4: left=0, right=1; different; 1
  • Cell 5: left=1, right=1; same; 0
  • Cell 6: left=1, right=1; same; 0
  • Cell 7: left=1, right=0; different; 1
  • After day 1: [1, 0, 1, 0, 1, 0, 0, 1]

Day 2 (apply same rule to day 1 result):

  • Cell 0: left=0, right=0; same; 0
  • Cell 1: left=1, right=1; same; 0
  • Cell 2: left=0, right=0; same; 0
  • Cell 3: left=1, right=1; same; 0
  • Cell 4: left=0, right=0; same; 0
  • Cell 5: left=1, right=0; different; 1
  • Cell 6: left=0, right=1; different; 1
  • Cell 7: left=0, right=0; same; 0
  • After day 2: [0, 0, 0, 0, 0, 1, 1, 0] (verified correct)

Solution (C++)

#include <iostream>
using namespace std;

void cellCompete(int cells[], int days) {
    int temp[8];
    while (days--) {
        for (int i = 0; i < 8; i++) {
            int left  = (i == 0) ? 0 : cells[i - 1];
            int right = (i == 7) ? 0 : cells[i + 1];
            temp[i] = (left == right) ? 0 : 1;
        }
        for (int i = 0; i < 8; i++) {
            cells[i] = temp[i];
        }
    }
}

int main() {
    int cells[] = {1, 0, 0, 0, 0, 1, 0, 0};
    int days = 1;
    cellCompete(cells, days);
    for (int i = 0; i < 8; i++) {
        cout << cells[i] << " ";
    }
    return 0;
}

Key Points for This Problem

  • The temp array is not optional. All cells read from the original state before any writes happen. Without it, updating cells[0] through cells[7] left to right would corrupt the state: cell 2 would read the already-updated cells[1] instead of the original value.
  • Boundary handling: left = (i == 0) ? 0 : cells[i-1] and right = (i == 7) ? 0 : cells[i+1]. Two lines, both essential.
  • Time complexity: O(8 * days), which simplifies to O(days) since the array size is fixed at 8.
  • The algorithm handles any number of days in sequence. Each iteration of the outer loop advances the simulation by exactly one day.

Problem 2: Maze Pathfinding (Mooshak’s Problem)

Problem Statement

A maze is represented as a 2D grid where 0 marks a wall, 1 marks an open path, and 9 marks the goal (the cheese). A mouse named Mooshak starts at position (0, 0) and can move up, down, left, or right. Diagonal moves are not allowed.

Write a function isPath(int** grid, int m, int n) that returns 1 if Mooshak can reach the cheese, or 0 if no valid path exists.

Why DFS Works Here

This is a reachability problem: does any path exist between the start and the goal? Depth-First Search handles this by exploring one branch as far as possible before backtracking and trying the next option.

The backtracking step matters. After marking a cell as visited (changing its value to 3), the algorithm restores it to 1 when a path through that cell fails. Without this restore step, cells that were visited during a failed branch would remain marked as walls. A valid path that loops back through those cells would then be blocked incorrectly.

The base case maze[x][y] == 0 handles both explicit walls and out-of-bounds indices (once bounds are checked first). When maze[x][y] == 9, the cheese is found and the recursion unwinds with true.

Step-by-Step Trace: Example 1

Input grid (3x3):

1  1  1
9  1  1
0  1  0
  • Start at (0,0) = 1. Mark as visited.
  • Try up: (-1, 0) is out of bounds; skip.
  • Try right: (0, 1) = 1; recurse.
  • Eventually, the DFS reaches (1, 0) = 9.
  • Output: 1 (path found)

Step-by-Step Trace: Example 2

Input grid (3x3):

0  0  0
9  1  1
0  1  1
  • Start at (0,0) = 0. The base case fires immediately: wall.
  • Output: 0 (no path, starting cell is blocked)

Solution (C++)

#include <iostream>
using namespace std;

#define N 8

bool isPathHelper(int maze[N][N], int x, int y) {
    if (x < 0 || y < 0 || x >= N || y >= N || maze[x][y] == 0)
        return false;
    if (maze[x][y] == 9)
        return true;
    maze[x][y] = 3;  // mark as visited
    if (isPathHelper(maze, x - 1, y)) return true;  // up
    if (isPathHelper(maze, x, y + 1)) return true;  // right
    if (isPathHelper(maze, x + 1, y)) return true;  // down
    if (isPathHelper(maze, x, y - 1)) return true;  // left
    maze[x][y] = 1;  // unmark on backtrack
    return false;
}

bool isPath(int maze[N][N]) {
    return isPathHelper(maze, 0, 0);
}

Key Points for This Problem

  • The order of the base-case checks matters: bounds check before value check, so maze[x][y] is never accessed out of bounds.
  • Marking with 3 instead of 0 allows the backtrack to restore the cell to 1 cleanly. Marking with 0 (treating it as a permanent wall) would incorrectly block alternative paths.
  • Time complexity: O(N*N) in the worst case, since each cell in an N by N grid is visited at most once.
  • BFS is a valid alternative and finds the shortest path. For a pure reachability question, DFS is simpler to implement quickly under exam pressure.

What These Problems Reveal About AMCAT Automata Patterns

The two problems above are not arbitrary. They represent two structural templates that appear repeatedly across AMCAT Automata question banks.

The first template is array state simulation. An array advances through discrete time steps, where each element’s new value depends on its neighbours in the current state. Variations include Conway’s Game of Life rules, bitwise transformations, and sliding-window state updates. The fix always involves separating reads from writes, typically with a temporary buffer.

The second template is graph or grid traversal. The task is to find a path, reach a target, or check reachability in a 2D grid. Variations change the goal cell, add weights, restrict movement directions, or ask for the shortest path (switch from DFS to BFS). The fix always requires tracking visited state and handling boundary conditions without index errors.

Knowing these two templates changes how you approach the test. When a problem involves an array transforming over time, you reach for the temporary-buffer pattern. When a problem involves a grid and movement, you reach for DFS or BFS with visited tracking.

The AMCAT Automata module-wise syllabus shows how these templates map across the full subject list. Arrays, strings, recursion, and basic graph traversal together cover the majority of easy-level questions. Adding dynamic programming, tree traversal, and sliding window brings in the hard-level range.


Building Your Preparation Plan

Four weeks of daily practice is a realistic preparation window for the AMCAT Automata section. The goal is pattern recognition and timed execution, not grinding through hundreds of problems.

WeekFocusDaily target
1Arrays and strings: state simulation, in-place operations, sliding window2 problems
2Recursion and backtracking: DFS, tree traversal, generate-and-test2 problems
3Sorting, searching, two-pointer, basic dynamic programming2 problems
4Timed mock sessions: 2 problems in 30 minutes, full session conditions1 mock per day

On test day, read both problems before writing any code. The easy problem gives you reliable points. Submit a working solution to the easy one first, then move to the hard one. A partial solution on the hard problem that passes several test cases is worth more than running out of time while debugging a theoretically perfect approach.

Check AMCAT exam dates, fees, and registration before booking a session. The test is available at approved centres and online, with booking slots open year-round for most cities.


The AI Connection: Why These Patterns Reappear

Array state simulation and graph traversal are not purely placement-exam topics. The cell competition simulation from Problem 1 is structurally identical to how reinforcement learning environments model grid worlds: every cell holds a state, every timestep advances that state based on neighbouring values, and the simulation runs for a fixed number of steps. Problem 2’s DFS search is the same algorithm used in decision-tree traversal and model-state exploration in AI systems.

For engineering students building toward roles where AI tools are part of the job, these algorithmic foundations carry forward directly. The 2026 AI roadmap for Indian engineering students maps out where these fundamentals lead, from placement-ready coding to building and deploying AI features in production.

TinkerLLM (₹299 to start) is a hands-on sandbox for applying these foundations to LLM-based systems. The state-iteration thinking in Problem 1 and the search-space logic in Problem 2 surface repeatedly once you move from competitive programming into building real AI features.

Primary sources

Frequently asked questions

What types of problems appear in AMCAT Automata Set 1?

Set 1 covers two representative problem types: array state simulation (cell competition) and graph traversal (maze pathfinding using DFS). These map to the easy-to-medium range you will see in the actual AMCAT Automata section.

Why does the cell competition solution use a temporary array?

All 8 cells update simultaneously using each day's original state. If you modify cells in place left to right, later cells would read already-updated values from earlier cells and produce wrong results. The temporary array preserves the original state throughout the iteration.

What does the AMCAT Automata grader actually measure?

The automated grader scores submissions on four axes: correctness across basic, advanced, and edge-case tests; time complexity; runtime error handling; and whether the approach follows industry-standard patterns. A solution that passes basic cases but uses exponential time scores lower than one with efficient, clean code.

Can I use BFS instead of DFS for the maze problem?

Yes. BFS also finds a valid path and gives you the shortest one as a bonus. BFS uses a separate visited array and does not require backtracking. For AMCAT Automata, both approaches are accepted; choose whichever you can implement faster under time pressure.

Which languages are supported in AMCAT Automata 2.0?

The Automata 2.0 platform supports C, C++, Java, and Python. C++ is the most common choice among placement students because STL containers reduce boilerplate. Use the language you can write and debug fastest.

How is AMCAT Automata different from Automata Fix?

Automata presents a problem statement and asks you to write code from scratch. Automata Fix gives you pre-written code with bugs and asks you to identify and correct the errors. The two sections test different skills and often appear together in the same AMCAT session.

Build AI projects

A self-paced playground for building with LLMs.

TinkerLLM is FACE Prep's sister property. A guided environment for shipping real LLM applications, the kind of project that earns a paragraph on your resume, not a line.

Try TinkerLLM (₹299 launch)
Free AI Roadmap PDF