官解 一遍写出来有难度。 [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 …