From ee67d3e6a7293cac13c98633041e0c8228627566 Mon Sep 17 00:00:00 2001 From: huangjikun <72253502+xiaomiusa87@users.noreply.github.com> Date: Fri, 3 May 2024 19:40:59 +0800 Subject: [PATCH] Maintain the same semantics as other languages in n_queens.go (#1329) --- codes/go/chapter_backtracking/n_queens.go | 1 + 1 file changed, 1 insertion(+) diff --git a/codes/go/chapter_backtracking/n_queens.go b/codes/go/chapter_backtracking/n_queens.go index f2a74021a..5d7e7fb23 100644 --- a/codes/go/chapter_backtracking/n_queens.go +++ b/codes/go/chapter_backtracking/n_queens.go @@ -15,6 +15,7 @@ func backtrack(row, n int, state *[][]string, res *[][][]string, cols, diags1, d } *res = append(*res, newState) + return } // 遍历所有列 for col := 0; col < n; col++ {