โ† Infosys questions

Count Warship Groups

Filed under Infosys

Given an m x n 2D grid representing a battlefield with warships as '1's and water as '0's, return the number of distinct warship groups. Warships are connected 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.

Related Infosys questions

Collected from public candidate posts and coding forums. Updated Nov 2026.