I solved the algorithm and now the task was to solve the algorithm; the input is an array of numbers;
public int maxProduct(int input[]) { int maxProductValue= input[0]*input[1]; for (int i =1 ; i<input.length;i++){ if (maxProductValue<input[i]*input[i-1]) maxProductValue=input[i]*input[i-1]; } return maxProductValue; } Everything works but something tells me that I can decide more beautifully. I will be grateful for the decision
ifbe replaced withmaxProductValue = max(maxProductValue, input[i]*input[i-1]);- PashaPash ♦