• + 4 comments

    1) You don't need to increase time complexity by sorting the array afterwards, you should get the ongoing max value.
    2) You don't need to increase space complexity by creating a int array.