Your question is Battleship Probe Challenge. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
You are given a square grid of size N (N>=3); using a probe API find a 1x3 or 3x1 ship on the grid (battleship variant)
Asked in the phone screen, coding stage. Treat grid[row][col] as the result of probing that cell, where 1 means occupied and 0 means empty. Return the three coordinates of the first ship found in row-major search order, checking horizontal ships before vertical ships for each scan, or return [] if none exists.
find_ship(n, grid) receives an integer n and an n x n binary list. Return a list of three [row, column] coordinate lists.
def find_ship(n, grid):