mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-06 09:23:19 +08:00
Update 15. 3Sum.go
unnecessary
This commit is contained in:
@ -8,9 +8,7 @@ import (
|
|||||||
func threeSum(nums []int) [][]int {
|
func threeSum(nums []int) [][]int {
|
||||||
sort.Ints(nums)
|
sort.Ints(nums)
|
||||||
result, start, end, index, addNum, length := make([][]int, 0), 0, 0, 0, 0, len(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++ {
|
for index = 1; index < length-1; index++ {
|
||||||
start, end = 0, length-1
|
start, end = 0, length-1
|
||||||
if index > 1 && nums[index] == nums[index-1] {
|
if index > 1 && nums[index] == nums[index-1] {
|
||||||
|
Reference in New Issue
Block a user