Given an N x N matrix where 1 represents land and -1 represents ocean, calculate the total number of connected islands. An island is formed by connecting adjacent land cells horizontally or vertically…
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.