MEDIUMasked at 1 company

First Completely Painted Row or Column

A medium-tier problem at 64% community acceptance, tagged with Array, Hash Table, Matrix. Reported in interviews at Citadel and 0 others.

Founder's read

You're looking at a matrix problem that asks you to find the first row or column where every cell is painted. Citadel has asked this one. It's a medium-difficulty problem with a 64% acceptance rate, which means most people who attempt it get it right, but plenty still mess up the tracking logic. The catch isn't the algorithm itself, it's maintaining state efficiently across rows and columns simultaneously without burning memory or falling into an off-by-one trap. If this hits your live OA and you blank on the efficient approach, StealthCoder solves it in seconds, invisible to the proctor.

Companies asking
1
Difficulty
MEDIUM
Acceptance
64%

Companies that ask "First Completely Painted Row or Column"

If this hits your live OA

First Completely Painted Row or Column 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 StealthCoder
What this means

The straightforward approach counts painted cells per row and per column, checking if any reaches the full length. The real trick is doing this in a single pass without nested loops or redundant scans. You need a hash table or two arrays to track paint counts for each row and column as you iterate, then return whichever completes first. The common mistake is not tracking which index finished first when multiple rows or columns fill up at the same time, or getting confused about whether to check during iteration or after. The Array and Hash Table topics here aren't about complex data structures; they're about the discipline of O(n*m) time with O(n + m) space. StealthCoder handles the bookkeeping so you don't second-guess yourself under pressure.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

First Completely Painted Row or Column recycles across companies for a reason. It's medium-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.

First Completely Painted Row or Column interview FAQ

Is this really a medium problem or is the acceptance rate misleading?+

At 64% acceptance, most people solve it, but the remaining 36% usually stumble on state management. The algorithm itself is straightforward; the friction comes from tracking both dimensions and handling the return condition correctly. It's genuinely medium.

Does Citadel ask this as a screening filter or deeper in the loop?+

Input data doesn't specify the stage. Assume it's a screening or early-round problem. It's the kind of problem designed to separate candidates who can maintain clean state from those who get tangled in their own logic under time pressure.

What's the trick to not overthinking the implementation?+

Iterate once, increment a counter for each row and column as you see painted cells, and check those counters against row/column length. Don't re-scan. Hash table or simple array both work. The trick is committing to one approach and not second-guessing it mid-implementation.

Should I optimize for space or time here?+

Time is already O(n*m) because you have to visit every cell. Space is O(n + m) for the counters. Don't try to save space; it won't help. Focus on correctness and clean state tracking instead.

How does this relate to the Hash Table and Array topics listed?+

Hash Table tracks paint counts per row/column in constant-time lookups. Array does the same with direct indexing. Either tool works. The topics are really about picking the right data structure for O(1) updates, not about complex hashing or array algorithms.

Want the actual problem statement? View "First Completely Painted Row or Column" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.