Island Perimeter 🚂

Input: grid = [[0,1,0,0],[1,1,1,0],[0,1,0,0],[1,1,0,0]]
Output: 16
Explanation: The perimeter is the 16 yellow stripes in the image above.
Input: grid = [[1]]
Output: 4
Input: grid = [[1,0]]
Output: 4
  • row == grid.length
  • col == grid[i].length
  • 1 <= row, col <= 100
  • grid[i][j] is 0 or 1.
  • There is exactly one island in grid.

Solution

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Later Gödel on the Formalization of Mathematics: A Comment on Hanna’s “Rational Human Mindedness…

Armenian Numbers: Best Ultimate Guide To Count To 1 Billion

The Pythagorean Theorem, Time and Einstein: E=mc² is Incomplete

Significance Of Line Parameters On the SAT: Slope Questions

Notice What’s Being Asked: Questions On the SAT / ACT Math Section

Interesting GMAT, GRE Counting Quant Problem

Jeremiah LaBrash

An Intuitive Explanation of Expected Utility Theory- Behavioural Economics 1

Factors of 147 | All Factors of 147

Factors of 147

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tehleel Mir 🐢

Tehleel Mir 🐢

More from Medium

Merge k Sorted Lists 🐫

Need of different sorting techniques

HackerRank Algorithm

02. A Trip to Objectville