Find the Width of Columns of a Grid
A easy-tier problem at 69% community acceptance, tagged with Array, Matrix. Reported in interviews at Samsung and 1 others.
You're given a 2D grid of strings and need to return the width of each column. Sounds simple until you realize the strings vary in length and you have to track them correctly. Samsung and Atlassian both ask this, and it hits the acceptance rate at 69 percent, which means a solid chunk of candidates miss the setup or indexing. The problem tests whether you can iterate cleanly through a matrix without off-by-one errors. If you blank on the structure during your live OA, StealthCoder surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Find the Width of Columns of a Grid"
Find the Width of Columns of a Grid is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made for the engineer who has done the work but might still blank with a webcam pointed at him.
Get StealthCoderThe trap here is conflating column iteration with row iteration. You're not reading across rows and taking max lengths. You're reading down columns. For each column index, you scan every row and find the longest string at that position. Array and Matrix topics sit together because you're building a result array by iterating matrix-style. Common miss: assuming all rows have the same number of elements or forgetting to handle empty strings. The obvious brute-force passes easily on small grids. The real gotcha is clarity of code. Messy nested loops or wrong index order and you fail test cases. StealthCoder is your hedge for the one time you misread the column-scan logic under pressure.
Pattern tags
You know the problem.
Make sure you actually pass it.
Find the Width of Columns of a Grid recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find the Width of Columns of a Grid interview FAQ
Why is this acceptance rate only 69 percent if it's labeled easy?+
Candidates often confuse row-wise and column-wise iteration. The problem is algorithmically trivial but demands clean indexing. Off-by-one errors and incorrect loop nesting are the main killers, not algorithmic depth.
Do Samsung and Atlassian ask this the same way?+
Both companies report asking this problem, but exact wording and constraints may vary per round. The core task remains: find max string length per column. Prepare for minor input format tweaks.
What's the trick to not mess up the nested loop?+
Outer loop over column indices, inner loop over rows. For each column, track the max length of strings at that index. Test with uneven row lengths and empty strings before submitting.
Is this problem still asked at big tech companies?+
Yes. Samsung and Atlassian both have it in active rotation. Easy problems often appear early in screens to filter basic coding competence. Don't sleep on it.
How does this relate to Array and Matrix topics?+
You're working with a 2D structure (Matrix) and returning a 1D result (Array). It's a bridging problem that tests both 2D navigation and aggregation into a simpler form.
Want the actual problem statement? View "Find the Width of Columns of a Grid" on LeetCode →