Finding the perimeter of a river

Hard

Given a matrix of 1s and 0s representing a map of rivers, where 1 denotes water (river) and 0 denotes land/river bank, and assuming connectivity only horizontally and vertically, write a function to compute the perimeter of the river....

Sign in to InterviewQs to view this question

Or

New to InterviewQs? Sign up now.

By proceeding, you agree to our Terms and Conditions and Privacy Policy.

Loading editor...