Fourth requirement is not satisfied here What is the problem here ?? And the recommendation from the mentor was that I have used too many methods in the class but i have used only one method that is max What is the problem here ?? Pls reply asap
package com.codegym.task.task05.task0532;
import java.io.*;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(reader.readLine());
int num[] = new int[50];
int maxn[][] = new int[50][50];
for(int i=0;i<n;i++)
{
num[i] = Integer.parseInt(reader.readLine());
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(i==0)
{
maxn[i][j] = num[j];
}
else
{
int num1 = maxn[i-1][j];
int num2 = maxn[i-1][j+1];
maxn[i][j] = max(num1,num2);
}
}
}
int maximum = maxn[n-1][0];
//write your code here
System.out.println(maximum);
}
public static int max(int a,int b)
{
if(a>b)
{
return a;
}
else if(a==b)
{
return a;
}
else
{
return b;
}
}
}