def solution(nums: str) -> str:
lst = [int(x) for x in nums.split()]
# lst = nums.split()
return f'{max(lst)} {min(lst)}'
public String HighestAndSmallest(String string){
String str=string.split("\s+");
if(str.length<2){
return null;
}
int len=str.length;
int tmp1=Integer.parseInt(str[0]);
int tmp2=Integer.parseInt(str[len-1]);
int highest=tmp1>tmp2?tmp1:tmp2;
int smallest=tmp1<tmp2?tmp1:tmp2;
for(int i=1;i<(len+1)/2;i++){
int temp1=Integer.parseInt(str[i]);
int temp2=Integer.parseInt(str[len-1-i]);
if(temp1>temp2){
if(temp1>highest) highest=temp1;
if(temp2<smallest) smallest=temp2;
}else{
if(temp2>highest) highest=temp2;
if(temp1<smallest) smallest=temp1;
}
}
return highest+" "+smallest;
}
def solution(nums: str) -> str:
b = nums.split(" ")
print(b)
c = list(map(int, b))
return str(max(c))+" "+str(min(c))
def solution(nums: str) -> str:
numl = nums.split(" ")
numl = [int(i) for i in numl]
return (str(max(numl)) + " " + str(min(numl)))
def solution(nums: str) → str:
# your code here
s = s.split()
s = [int(i) for i in s]
s.sort()
return str(s[-1]) + ’ ’ + str(s[0])
def solution(nums: str) -> str:
# your code here
nums_list = [int(i) for i in nums.split(' ')]
return f"{max(nums_list)} {min(nums_list)}"
import java.util.Arrays;
public class MaxAndMin {
public String getMaxAndMin(String str) {
String s = str.split("\s+");
int intArray = new int[s.length];
for (int i = 0; i < s.length; i++) {
intArray[i] = Integer.parseInt(s[i]);
}
Arrays.sort(intArray);
return intArray[intArray.length - 1] + " " + intArray[0];
}
}
def solution(nums: str) -> str:
nums_list = nums.split(" ")
nums_list_int = []
for i in nums_list:
nums_list_int.append(int(i))
return " ".join([str(max(nums_list_int)), str(min(nums_list_int))])
assert solution("1 2 3 4 5") == "5 1"
assert solution("1 2 -3 4 5") == "5 -3"
assert solution("1 9 3 4 -5") == "9 -5"
assert solution("1 2 3") == "3 1"
assert solution("8 3 -5 42 -1 0 0 -9 4 7 4 -4") == "42 -9"
def solution(nums: str) -> str:
res_list=[]
nums_list=[int(nums.split(" ")[i]) for i in range(len(nums.split(" ")))]
res_list.append(str(max(nums_list)))
res_list.append(str(min(nums_list)))
return " ".join(res_list)
assert solution("1 2 3 4 5") == "5 1"
assert solution("1 2 -3 4 5") == "5 -3"
assert solution("1 9 3 4 -5") == "9 -5"
assert solution("1 2 3") == "3 1"
assert solution("8 3 -5 42 -1 0 0 -9 4 7 4 -4") == "42 -9"