MCPcopy Create free account
hub / github.com/Flamewaker/JavaPersonalSummary / ByteDance01

Class ByteDance01

Code/exam/ByteDance01.java:15–61  ·  view source on GitHub ↗

@author todd @date 2020/6/25 8:31 @description: 字典序 给定整数n和m, 将1到n的这n个整数按字典序排列之后, 求其中的第m个数。 既然是字典序,那么很自然,我们可以考虑使用字典树来实现,但是,这里并不需要真的生成这个字典树,而只需要计算对应分支的节点数就行了。计算分支节点数,那么很简单,节点数就是上级节点 10,总的节点数= 1 + (1 10) + (1 10 10) + (1 10 10 10) +……,这里需要注意最后的边界,n以内的节点数,那么,最后相加的时候必须要把n+1 ~ (1 10 10 ……)这几个数去掉。 既然知道了如何

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected