Retired

Search for the Target in 2D Matrix (retired)

Description:

Given an integer matrix matrix, you are tasked to return a tuple containing the row and column indices of the integer target. If the target is not in the matrix, return None.

The following are the properties of the matrix:

  • Each list within the matrix has equal sizes, meaning the matrix is a square or rectangle.
  • Each row is sorted in increasing order.
  • The first integer of a row is larger than the last integer of the previous row.

Example 1:

Input: matrix = [[1,2,4,5], [6,8,10,12], [13,15,17,20], [21,22,24,26]], target = 10 Output: (1,2)

Example 2:

Input: matrix = [[1,2,4,5], [6,8,10,12], [13,15,17,20], [21,22,24,26]], target = 11 Output: None

More By Author:

Check out these other kata created by logicale

Stats:

CreatedJan 25, 2025
Warriors Trained14
Total Skips0
Total Code Submissions22
Total Times Completed11
Python Completions11
Total Stars0
% of votes with a positive feedback rating29% of 7
Total "Very Satisfied" Votes0
Total "Somewhat Satisfied" Votes4
Total "Not Satisfied" Votes3
Total Rank Assessments7
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • logicale Avatar
Ad