Skip to content

Commit 5459f18

Browse files
Ikhansiriak
andauthored
Use multiple assignment instead of a temp variable (#300)
Co-authored-by: Andrii Siriak <[email protected]>
1 parent 22c2739 commit 5459f18

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

sorts/selectionsort.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ func SelectionSort(arr []int) []int {
1111
}
1212
}
1313

14-
tmp := arr[i]
15-
arr[i] = arr[min]
16-
arr[min] = tmp
14+
arr[i], arr[min] = arr[min], arr[i]
1715
}
1816
return arr
1917
}

0 commit comments

Comments
 (0)