# solve question using recursion [JAVA]

Question 1:

solution must be with recursion.

for a two dimensional array of positive integers how can I return the longest path (steps), so that the value in each cell of the longest path is from descending series of integers and the difference between each cell and cell is a given number (num).

Assumes that n is a value of the cell so (n - num) is a positive number (not zero).

can't use any loops (for,while,...etc)

the Method:

public static int longestPath(int matrix[][],int number){...

}

For example:

int number=1;

int [][]matrix ;

matrix = new int[][]{{8, 15, 20, 33, 35},

{60, 59, 58, 32, 31},

{59, 17, 57, 56, 55},

{55, 15, 13, 58, 16}};

[login to view URL](" longestPath= "+ longestPath(matrix, num));

}

if we search for the longest path with the difference number = 1

1-in the cell matrix[0][3] the path long is 3 and the value in this path is 33 -> 32 -> 31 ends in matrix[1][4]

2-in the cell matrix[1][0] the path long is for 6 and the value in the path 60 -> 59 -> 58 -> 57 -> 56 -> 55 ends in matrix[2][4]

3-in the cell matrix[1][0] the path long is 2 and the value in this path is 60 -> 59 ends in matrix[2][0]

so the method must return the longest path witch its 6

if we search for the longest path with the difference number = 2

1-in the cell matrix[2][1] the path long is 3 and the value in this path is 17 -> 15 -> 13 ends in matrix[3][2]

the method must return the longest path witch its 3.

О работодателе:
( 1 отзыв ) haifa, Israel

ID проекта: #18525053

## Поручен:

NovaSofts

Hello Sir/ Ma’am We are a group of Software Engineers having 10+ years of experience. Expert in JAVA, C, C++ , C# , Python, ANDROID,IOS, MATLAB, IONIC. Done 560+ projects here on FREELANCER.COM. Please che Больше

\$30 USD за 1 день
(344 отзывов(-а))
7.6

## 10 фрилансеров(-а) в среднем готовы выполнить эту работу за \$26

urmate

Hi There I've excellent programming and development skills and knowledge. I can provide an efficient, perfect, well documented development of your Programming and Computer project according to 100% accuracy and Больше

\$30 USD за 1 день
(455 отзывов(-а))
7.0
AhmedLabib93

Hello My name is Ahmed, i'm a top rated freelancer. i worked over 400 projects and over 700 hours doing java projects. plus i passed freelancer java v3 exam with score 3.75 plus i got 2 java certificate 1Z0-803 and 1Z Больше

\$35 USD за 1 день
(418 отзывов(-а))
6.6
cma93

HI, I'm an experienced programmer. I'm interested in your task and would like to do it. I'm available so contact me anytime to get started..................... Thanks.

\$30 USD за 1 день
(17 отзывов(-а))
4.8
MubashirAs62

Hello, I've read your requirements for recursive solution, I can do this for you, feel free to contact me and ask anything regarding this. Hope you will get what you want. Thank You

\$30 USD за 1 день
(2 отзывов(-а))
2.0
bomerb

I have 5+ years of Java experience. I have read the description. I can start immediately and deliver you r code in couple of hours. Hope we can work together.

\$20 USD за 0 дней(-я)
(1 отзыв)
1.2
nikecarvaggio

I'm a software engineer

\$25 USD за 2 дней(-я)
(0 отзывов(-а))
0.0
benmarbihamza

hello sir I have good experience in java under both windows and Linux I compile java code with cmd or terminal and I use eclipse and netbeans this project easy for me when I complete it you can check an Больше

\$15 USD за 1 день
(0 отзывов(-а))
0.0