We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This solution passes all the test cases. It has O(N) time and O(1) space. I wonder if this is more readable solution:
`public static MinMax findMinMax(List A) { Integer min = Integer.MAX_VALUE; Integer max = Integer.MIN_VALUE;
for(int n: A){ if(n<min) min = n; if(n>max) max = n; } return new MinMax(min, max);
}`
(I was asked this question in an interview and solved this way)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This solution passes all the test cases. It has O(N) time and O(1) space. I wonder if this is more readable solution:
`public static MinMax findMinMax(List A) {
Integer min = Integer.MAX_VALUE;
Integer max = Integer.MIN_VALUE;
}`
(I was asked this question in an interview and solved this way)
The text was updated successfully, but these errors were encountered: