func ibwt(last []byte, root int) []byte { var sums [256]int for _, b := range last { sums[b]++ } pre := 0 for i, add := range &sums { sums[i] = pre pre += add } var ( n = len(last) next = make([]int, n) ) for after, b := range last { before := sums[b] sums[b] = before + 1 next[before] = after } var ( at = root to = make([]byte, n) ) for i := range to { to[i] = last[at] at = next[at] } return to }
To receive a hint, submit unfixed code.