Check Matrix Reflection Symmetry
Updated
Problem statement
Return whether a rectangular matrix is unchanged by at least one of these reflections:
- Reverse the order of its rows, reflecting top to bottom.
- Reverse the entries within every row, reflecting left to right.
Return true if either reflection leaves every entry unchanged. Otherwise, return false.
For this exercise, assume that the input is a nonempty matrix of integers.
Function
reflectionSymmetric(matrix: int[][]) → booleanExamples
Example 1
matrix = [[1,2,1],[3,4,3]]return = trueReversing the entries within each row gives the original matrix, so the left-to-right reflection matches.
Example 2
matrix = [[1,2],[2,1]]return = falseBoth reflections give [[2,1],[1,2]], which differs from the input.
Constraints
- For this exercise, assume the matrix has between 1 and 50 rows.
- Each row has between 1 and 50 entries.
- Every row has the same number of entries.
- Every entry is between -10^9 and 10^9, inclusive.
More Intuit Online Assessment questions
- Employee Promotion OpportunitiesOA · Seen Oct 2026
- Next Pascal Row CoefficientOA · Seen Oct 2026
- Parse Router LogsOA · Seen Oct 2026
- Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
- Maximum Square-Free DivisorOA · Seen Oct 2026
- Two Tribes from Taller-Person CountsOA · Seen Oct 2026
- Shortest Path from an Encoded GraphOA · Seen Sep 2026
- Oldest and Youngest EmployeesOA · Seen Sep 2026
- Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
- Submask Sum QueriesOA · Seen Sep 2026
Similar questions at other companies
- Survey Table: Group Given an AnswerSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Wind-Blown Leaves Remaining in a GridAbridge · OAAbridge interview questions
- Query a Header-Encoded MatrixNVIDIA · OANVIDIA interview questions
- Trapped Characters in a GridAdobe · OAAdobe interview questions
- Center Crop a Grayscale ImageLuma AI · OALuma AI interview questions
- Find Zero Cells in a 2×2 GridRoblox · OARoblox interview questions
- Make Pixel Columns Strictly IncreasingMicrosoft · OAMicrosoft interview questions
- Count Pieces After Othello MovesHudson River Trading · OAHudson River Trading interview questions
- Tic-Tac-Toe Board StatusPinecone · OA
- Cherry PickupInfosys · OAInfosys interview questions