Question: Recursion count marks Please write NEW code in java. Dont use answers from other questions, please write NEW CODE to do the following: Write a

Recursion count marks
Please write NEW code in java. Dont use answers from other questions, please write NEW CODE to do the following:
Write a code to traverse a matrix to count how many "?" marks are grouped. A group is when all the ? marks are touching up, left, down, and right. NOT diagonally. A comma is used to represent a blank space in the matrix.
here is the code given:
int start(String m, String c) {
String[][] mat;
boolean[][] visited;
//code goes here
}
String m contains the symbols of ? and ,
String c contains the coordinates.
String m is
,,,,,,,,,, ,,,??????? ???,,,,??, ?,,,,,,??? ,,,,,????, ???,,,,,,, ???????,,, ???,,,,,?? ,,,,,,,,,, ,,,,,????,
The spaces resemble where one row stops and the next begins so it would look like
, , , , , , , , , ,
, , , ???????
???, , , , ??,
?, , , , , , ???
, , , , , ????,
???, , , , , , ,
???????, , ,
???, , , , , ??
, , , , , , , , , ,
, , , , , ????,
String c is
1 1 2 7 2 0 6 6
The output is:
0
16
4
13
Iterate through string m and store it in the matrix. You can store the coordinates in a matrix with two columns, if you want.
Please keep the code as simple and short as possible (beginner recursive)
Please use the code given
int start(String m, String c) {
String[][] mat;
boolean[][] visited;
//code goes here
}
Please try to keep the code in the start class.
Make sure the code prints:
0
16
4
13
Thanks!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!