TEST CASE 2 wrong

The code is completely correct but then also test case 2 is wrong.
Please help

Hello @Prakhar_Nagpal,

There are two mistakes in your code:

  1. How are you so sure that there won’t be more than 100 elements?
    Solution:
    int arr[n];

  2. Your code will fail for the case when all the elements will be negative.
    Reason:
    You have initialized the max variable to 0.
    Solution:
    max=INT8_MIN;
    This will initialize it with the minimum value of int.

Hope, this would help.
Give a like if you are satisfied.