Change path

This commit is contained in:
halfrost
2022-09-07 20:20:20 +08:00
parent 35a447cad6
commit 2a40f7cefb
13 changed files with 13 additions and 13 deletions

View File

@ -1,7 +1,7 @@
package leetcode
import (
"github.com/halfrost/LeetCode-Go/template"
"github.com/halfrost/leetcode-go/template"
)
// 解法一 map时间复杂度 O(n)

View File

@ -1,7 +1,7 @@
package leetcode
import (
"github.com/halfrost/LeetCode-Go/structures"
"github.com/halfrost/leetcode-go/structures"
)
// TreeNode define

View File

@ -4,7 +4,7 @@ import (
"fmt"
"testing"
"github.com/halfrost/LeetCode-Go/structures"
"github.com/halfrost/leetcode-go/structures"
)
type question129 struct {

View File

@ -1,7 +1,7 @@
package leetcode
import (
"github.com/halfrost/LeetCode-Go/template"
"github.com/halfrost/leetcode-go/template"
)
var dir = [][]int{

View File

@ -4,7 +4,7 @@ import (
"fmt"
"testing"
"github.com/halfrost/LeetCode-Go/structures"
"github.com/halfrost/leetcode-go/structures"
)
type question138 struct {

View File

@ -1,7 +1,7 @@
package leetcode
import (
"github.com/halfrost/LeetCode-Go/structures"
"github.com/halfrost/leetcode-go/structures"
)
// ListNode define

View File

@ -4,7 +4,7 @@ import (
"fmt"
"testing"
"github.com/halfrost/LeetCode-Go/structures"
"github.com/halfrost/leetcode-go/structures"
)
type question141 struct {

View File

@ -1,7 +1,7 @@
package leetcode
import (
"github.com/halfrost/LeetCode-Go/structures"
"github.com/halfrost/leetcode-go/structures"
)
// ListNode define

View File

@ -1,7 +1,7 @@
package leetcode
import (
"github.com/halfrost/LeetCode-Go/structures"
"github.com/halfrost/leetcode-go/structures"
)
// ListNode define

View File

@ -4,7 +4,7 @@ import (
"fmt"
"testing"
"github.com/halfrost/LeetCode-Go/structures"
"github.com/halfrost/leetcode-go/structures"
)
type question143 struct {

View File

@ -31,4 +31,4 @@ Given 1->2->3->4->5, reorder it to 1->5->2->4->3.
更好的做法是结合之前几道题的操作:链表逆序,找中间结点。
先找到链表的中间结点,然后利用逆序区间的操作,如 [第 92 题](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0092.Reverse-Linked-List-II) 里的 reverseBetween() 操作,只不过这里的反转区间是从中点一直到末尾。最后利用 2 个指针,一个指向头结点,一个指向中间结点,开始拼接最终的结果。这种做法的时间复杂度是 O(n),空间复杂度是 O(1)。
先找到链表的中间结点,然后利用逆序区间的操作,如 [第 92 题](https://github.com/halfrost/leetcode-go/tree/master/leetcode/0092.Reverse-Linked-List-II) 里的 reverseBetween() 操作,只不过这里的反转区间是从中点一直到末尾。最后利用 2 个指针,一个指向头结点,一个指向中间结点,开始拼接最终的结果。这种做法的时间复杂度是 O(n),空间复杂度是 O(1)。

View File

@ -1,7 +1,7 @@
package leetcode
import (
"github.com/halfrost/LeetCode-Go/structures"
"github.com/halfrost/leetcode-go/structures"
)
// TreeNode define

View File

@ -4,7 +4,7 @@ import (
"fmt"
"testing"
"github.com/halfrost/LeetCode-Go/structures"
"github.com/halfrost/leetcode-go/structures"
)
type question144 struct {