Java Array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Java Array

So I wanted to make a program, that checks , if the number line is written in order or not, for example if it's 1 2 3 4 5 6 .. then the program prints out that result is 1 ( ordered ) and if it's 2 5 2 1 2 3 4 .. , the program prints out the result 2 ( not in order ) . The thing is that I want to print out the count ( how many numbers are in array ) and the numbers ( that were input in ), but still have no progress with that. Can someone help me with it? https://code.sololearn.com/cNgPAMfyx2X5 - there is the code. Thank you !

24th Nov 2021, 8:59 AM
Raitis
Raitis - avatar
3 Answers
+ 3
I really hope you like it, I made this for you https://code.sololearn.com/c2SMs4fO02fo // Keep learning & happy coding :D
24th Nov 2021, 11:18 AM
SoloProg
SoloProg - avatar
+ 2
You seem to be using recursions there. Is there a requirement for use of recursion? I just think it might be simpler with iteration ...
24th Nov 2021, 9:06 AM
Ipang
+ 1
I just wanted to try recursion.
24th Nov 2021, 9:36 AM
Raitis
Raitis - avatar