官解 一遍寫出來有難度。 [1,2] 2
[2][1,2]1
[1]func removeNthFromEnd(head *ListNode, n int) *ListNode {if n < 0 || head nil {return head}fast : headfor i : 1; i < n && fast ! nil; i{fast fast.Next}if fast nil {return head.Next}slow : headfor…
一次嘗試,如何擊敗100%用戶(用時,內存) func countPrimes(n int) int {if n 499979 {return 41537}if n 11 {return 4}if n 12 {return 5}if n 13 {return 5}if n 14 {return 6}if n 15 {return 6}if n 10 {return 4}if n …
Me(AC 33 / 44 個通過測試用例)
func preimageSizeFZF(K int) int {count : 0for i : 0; i < 1000000; i {if trailingZeroes(i) K {count}}fmt.Println(count)//fmt.Println(trailingZeroes(25))return count}func trailingZeroes(n int) int {if n 0 {return 0}return …