题目:
题解:
func getSteps(cur, n int) (steps int) {first, last := cur, curfor first <= n {steps += min(last, n) - first + 1first *= 10last = last*10 + 9}return
}func findKthNumber(n, k int) int {cur := 1k--for k > 0 {steps := getSteps(cur, n)if steps <= k {k -= stepscur++} else {cur *= 10k--}}return cur
}func min(a, b int) int {if a > b {return b}return a
}