Programmers / Maximum and Minimum Values
Problem
- Link
- Description
- Find and return the maximum and minimum values among numbers in a space-separated string
- Type
- X
Solution 1
| |
- Description
- Split the string by spaces and convert to integers
- Return the maximum and minimum values of the converted numbers
- Time Complexity
- O(spaceCount(s))
- For loop iterates as many times as the number of numbers in the string
- Space Complexity
- O(spaceCount(s))
- Array size allocation proportional to the number of numbers in the string