please tell me what is problem in my solution ,why one test case is not correct
How to improve in success test cases
Can you please share your code so i can check your solution .
#include using namespace std; int main() { int n,a[10],i; cin>>n; for(i=0;i<n;i++) { cin>>a[i]; } int max=0; for(i=0;i<n;i++) { if(a[i]>max) max=a[i]; } cout<<max; return 0; }
you have take max size of array to be 10 but in case n is greater than 10 then that would raise a runtime error so best bet is to initialize array as arr[n] , also your max value is initialized with 0 but in case all the number of array are negetive than your solution will result in 0 which will not be correct so initialize it with -10000000001 .
here, I have corrected your code : https://ide.codingblocks.com/s/186126
In case of any doubt feel free to ask 
If you got the answer mark your answer as resolved
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.