Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am looking for the solution of this program in C++ programming language. I have attached the picture below and also the test cases it
I am looking for the solution of this program in C++ programming language. I have attached the picture below and also the test cases it needs to pass. Page_1 :
Page_2 :
Test Cases :
# test case 1 # B=['.##.#','#.#..','#...#','#.##.']
# test case 2 # B=['.#..#','##..#','...#.']
# test case 3 # B=['##.','#.#','.##']
# test case 4 # B=['...','...','...']
Submarines of size 2 , which come in two shapes: Destroyers of size 3 , which come in six shapes: that, given an array B consisting of N strings of length M each, returns an array R of three integers, such that: - R[0] represents the number of Patrol Boats, - R[1] represents the number of Submarines, - R[2] represents the number of Destroyers. Examples: 1. Given B =[ ".\#\#.\#", "\#.\#. .", "\#...\#", "\#.\#\#."], the function should return [2,1,2] as explained above. 2. Given B=[ [".\#. .\#", "\#\#..\#", "...\#."], the function should return [1,1,1]. 3. Given B = ["\#\#.", "\#.\#", ".\#\#"], the function should return [0,0,2]. 4. Given B = ["...", "...", "..."], the function should return [0,0,0]. Assume that: - N is an integer within the range [1..100]; - all strings in B are of the same length M from the range [1..100]; - every string in B consists only of the following characters: '.' and/or 'f; - every ship on the board is either a Patrol Boat (size 1), a Submarine (size 2) or a Destroyer (size 3)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started