[minMax(array)]https://gist.github.com/NeeradNandan/faa50561176bccc589fc94855b2cd631
I wondered if the code I made (not a developer/SE) without knowing any algorithm is good or if it can be optimized further. Please help me optimize it further and explain the algorithm (with steps) as well.