What's the mistake?

instead of initializing max with 0, intialize it with least value i.e -1000000000