Soultion for max element within array