This is classical puzzle and appeared in many World Puzzle Championships.
"Battleships" Puzzle Instructions:
In the diagram conceals a fleet consisting of some given ships of different size. Each segment of a ship occupies exactly one field of the diagram. Ships are in the diagram, either horizontally or vertically oriented and do not touch each other, neither horizontally or vertically or diagonally.
The numbers outside the chart indicate how many ship segments are there in each row or column of the chart. Determine the positions of ships in the chart.