xxxxx...
....xxxx
.x.....x
.xxxxxxx
Your are given a picture of a snake. Lowercase 'x' characters indicate parts of the snake, and '.'
characters represent
empty areas. The snake consists of a sequence of horizontal and vertical segments.
Successive segments in the snake share an 'x', which is considered to be in both segments.
No two 'x's from different segments of the snake are horizontally or vertically adjacent.
Given a String[] snake, return the length of the longest segment
in the snake. The picture is formed using successive elements of snake as successive
rows in the picure.
|