Question: PLEASE HELP: Looking to make this code more efficient without losing functionality, just seeing if its possible, must utilize only recursion and one loop import
PLEASE HELP: Looking to make this code more efficient without losing functionality, just seeing if its possible, must utilize only recursion and one loop
import java.util.Scanner;
public class Assignment
public static void mainString args
System.out.printlnEnter the number of items to read";
Scanner snew ScannerSystemin;
int nsnextInt;
int anew intn;
System.out.printlnEnter the numbers:";
forint i;i && n
ifhnhn
ff;
return findExacthhnhlength,f;
else
return findExacthhnnf;
return f;
private static int findMirrorint h int h int n int nint f
iffhlength
return f;
else
ifn && n
ifhnhnn
ff;
return findMirrorhhnnf;
else
return f;
return f;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
