나는 이렇게 학습한다/Algorithm & SQL
1018. Find the smallest integer in the array
daco2020
2022. 10. 18. 21:38
Given an array of integers your solution should find the smallest integer.
For example:
- Given [34, 15, 88, 2] your solution will return 2
- Given [34, -345, -1, 100] your solution will return -345
You can assume, for the purpose of this kata, that the supplied array will not be empty.
Solution:
# 1
def find_smallest_int(arr):
return sorted(arr, reverse=True).pop()
# 2
def find_smallest_int(arr):
return min(arr)
# 3
find_smallest_int = min