FastPrepCount Nearly Regular Matrix Crosses
Problems/Count Nearly Regular Matrix Crosses

Count Nearly Regular Matrix Crosses

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Two ZipRecruiter new-grad OA reports describe crosses made of a complete row and a complete column, equality outside the optional intersection exception, and counting fully regular crosses too. We supplied limits and a function signature.

A cross is one complete row and one complete column of a rectangular integer matrix.

A row-column pair is nearly regular when every cross element is equal except possibly their intersection cell. A fully regular cross also qualifies.

Return the number of qualifying row-column pairs.

Function

countNearlyRegularCrosses(matrix: int[][]) → int

Examples

Example 1

matrix = [[1,1],[1,2]]return = 2
matrix
01011112

The crosses centered at (0,0) and (1,1) have equal non-intersection elements.

Example 2

matrix = [[7]]return = 1
matrix
007

A one-cell cross qualifies vacuously.

Constraints

  • 1 <= rows,columns <= 50

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Rotate Matrix Regions Around the DiagonalsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Rotate Matrix Regions Around the DiagonalsHudson River Trading · OAHudson River Trading interview questions
  • Robot Navigation Around LasersRoblox · OARoblox interview questions
  • Leaves Remaining After Wind GustsOpenAI · OAOpenAI interview questions
  • Apply a Reversi MoveAmazon · OA
  • Flip, Invert, and Smooth a Binary ImageAbridge · OAAbridge interview questions
  • Count Straight-Line Word Occurrences in a GridOptiver · OAOptiver interview questions
  • First Completed Mingo LineEpic · OAEpic interview questions
  • Sort Every Matrix Border LayerCapital One · OACapital One interview questions
  • Rotate a Square Matrix ClockwiseVisa · OAVisa interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int countNearlyRegularCrosses(int[][] matrix) {
        // Write your code here.
    }

}
Checking account…