CJCoding With Joseph
15free / daySign inCreate account

Search A Grid

Write search_grid(grid: list[list[int]], target: int) -> tuple[int, int] that returns the (row, col) position of the first cell equal to target, scanning row by row and left to right with the two given loops, or (-1, -1) when the grid does not hold it. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: the number of rows, then one line of space-separated integers per row, then the target; the tests build the grid and print the tuple your function returns.

Expected Output:

(1, 1)

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
Data Structures & Algorithms
📥 Auto-Input:
2\n1 2 3\n4 5 6\n5\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.