This commit is contained in:
krahets
2024-04-22 02:35:43 +08:00
parent e95b3bddf2
commit b3c757c9f4
14 changed files with 409 additions and 34 deletions
@@ -92,7 +92,7 @@ comments: true
size := len(nums)
// 两层循环,时间复杂度为 O(n^2)
for i := 0; i < size-1; i++ {
for j := i + 1; i < size; j++ {
for j := i + 1; j < size; j++ {
if nums[i]+nums[j] == target {
return []int{i, j}
}