Given a list of integers arr, implement the bubble sort algorithm to sort the list in non-decreasing order. Bubble sort works by repeatedly swapping adjacent elements if they are in the wrong order.
Constraints
1 <= arr.length <= 1000
-10^3 <= arr[i] <= 10^3
Function Signature
defbubble_sort(arr: list[int]) -> list[int]:
Interviewer
Whenever you're ready, walk me through your approach or go straight to the code. The requirements are in the Question tab.