Update 15. 3Sum.go

unnecessary
This commit is contained in:
yzw
2021-01-29 16:56:08 +08:00
committed by GitHub
parent bcf217f7be
commit ebbb7354d6

View File

@ -8,9 +8,7 @@ import (
func threeSum(nums []int) [][]int {
sort.Ints(nums)
result, start, end, index, addNum, length := make([][]int, 0), 0, 0, 0, 0, len(nums)
if length > 0 && (nums[0] > 0 || nums[length-1] < 0) {
return result
}
for index = 1; index < length-1; index++ {
start, end = 0, length-1
if index > 1 && nums[index] == nums[index-1] {