Frontendx
README.md
SOLUTION.md
main.tsxentry
App.tsx
App.css
index.html
vite.config.ts
Installed
react@^19.2.0
react-dom@^19.2.0

Create a Grid of N×N Size and Incrementally Update Cell Value on Click — Okta Machine Coding Grid Challenge

Prompt

Accept a number N as input and render an N×N grid of cells. Each cell is initially empty. Clicking an empty cell fills it with max(existingNumbers) + 1 — i.e., it gets the next incremental value. Clicking a non-empty cell updates its value to max(existingNumbers) — the current maximum. The grid must be well-structured with modular components, use optimal state management to avoid unnecessary re-renders, compute the maximum value efficiently, and have clean minimal UI. Bonus points for explaining performance considerations. This was asked in Okta's SDE2 frontend machine coding interview.

Store grid as a 2D array or flat array with N*N cells, initialized to null or empty strings.
Test Results

Create a Grid of N×N Size and Incrementally Update Cell Value on Click — Okta Machine Coding Grid Challenge

Accept a number N as input and render an N×N grid of cells. Each cell is initially empty. Clicking an empty cell fills it with max(existingNumbers) + 1 — i.e., it gets the next incremental value. Clicking a non-empty cell updates its value to max(existingNumbers) — the current maximum. The grid must be well-structured with modular components, use optimal state management to avoid unnecessary re-renders, compute the maximum value efficiently, and have clean minimal UI. Bonus points for explaining performance considerations. This was asked in Okta's SDE2 frontend machine coding interview.