Find both the minimum and maximum of the list in a single pass using O(1) extra space
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
Find both the minimum and maximum of the list in a single pass using O(1) extra space. Initialize min_val and max_val to the first element, then loop through updating them. Print the result in the format: Min: X, Max: Y
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.