Remap Logical Core Columns Around Defective Cores Per Row
Last updated: November 29, 2026
Quick Overview
A wafer has rows of physical cores, each `width` wide, and some cores in each row are defective. Given the logical width the compiler needs, return for every row the physical column that backs each logical column (skipping defects in order), or None if any row has too few good cores.
Cerebras
November 29, 20260
0
0 solved
A wafer has rows of physical cores, each `width` wide, and some cores in each row are defective. Given the logical width the compiler needs, return for every row the physical column that backs each logical column (skipping defects in order), or None if any row has too few good cores.
Wafer-scale chips are only manufacturable because spare cores let the hardware hide defects behind a uniform logical grid. A phone screen version of this checks that you can turn that idea into clean, correct array code and reason about the failure case.
What the Interviewer Expects
- Clarifies whether order of logical columns must be preserved (it must, so neighbors stay adjacent)
- Builds each row's mapping in one pass over physical columns
- Returns a clear failure value when a row lacks enough good cores
- States O(rows x width) time and why it is optimal
- Mentions that preserving order keeps logical neighbors physically close
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- What if the logical grid also needs columns to line up vertically so north-south links stay short?
- How would you minimize the worst-case physical distance between logical neighbors?
- How would you handle defective links rather than defective cores?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: width physical columns per row, logical_width columns the program needs, and defects[r], a set of bad physical columns for row r. Output: a list per row of length logical_width where en...
High-Level Design
Each row is independent. Walk physical columns left to right, keep the good ones, and take the first logical_width. Any good cores past that are spares that remain unused. Taking the leftmost good c...