Golang solution


  • 0
    R
    func findPermutation(s string) []int {
        ret := make([]int, 0)
        for i:=0; i<= len(s); i++ {
            if i == len(s) || s[i] == 'I' {
                lenTemp := len(ret)
                for j:=i+1; j > lenTemp; j--{
                    
                    ret = append(ret, j)
                }
            }
        }
        return ret
    }
    
    

Log in to reply
 

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