摘要: package main import "fmt" func isValid(s string) bool { if len(s) <= 1 { return false } chMap := map[byte]byte{ '{': '}', '[': ']', '(': ')', } stack 阅读全文
posted @ 2024-06-07 15:23 gdut17_2 阅读(12) 评论(0) 推荐(0)
摘要: package main import "fmt" func twoSum(nums []int, target int) []int { numMap := map[int]int{} // num->idx for i := 0; i < len(nums); i++ { if idx, ok 阅读全文
posted @ 2024-06-07 15:18 gdut17_2 阅读(15) 评论(0) 推荐(0)
摘要: package main import "fmt" type ListNode struct { Val int Next *ListNode } // 创建链表 func createList(nums []int) *ListNode { head := &ListNode{} tail := 阅读全文
posted @ 2024-06-07 15:14 gdut17_2 阅读(19) 评论(0) 推荐(0)
摘要: package main import "fmt" type ListNode struct { Val int Next *ListNode } func reverseList(head *ListNode) *ListNode { var pre *ListNode // 前驱节点指针 cur 阅读全文
posted @ 2024-06-07 15:06 gdut17_2 阅读(16) 评论(0) 推荐(0)