Available question text
Given an n×n binary grid where you may swap any two rows or any two columns, determine whether you can reorder rows/columns to form an alternating "chessboard" pattern and if so return the minimum number of swaps, otherwise return -1. The core challenge is to verify feasibility from the row/column pattern constraints (only two complementary row types and two complementary column types with correct counts) and compute the minimal row-swaps and column-swaps needed to achieve an alternating arrangement.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
Amazon
Leetcode 782. Transform to Chessboard
Reported Aug 26, 2024 · 1 source report
INTERN
Source snapshot: Nov 12, 2026
View source