Implement max method without sorting