Why am I always getting TLE with golang implementation


  • 0
    A
    func countBits(num int) []int {
        ret := make([]int, num + 1)
        for i := 1; i <= num; i++ {
            ret[i] = ret[i >> 1] + i & 1
        }
        return ret
    }
    

    the solution is quite simple, but why it was TLE

    the output is: "Last executed input: 262144"


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.