Missing Number[回溯][难]

2. Missing number 转自:https://mp.weixin.qq.com/s/WLRXLdi-3igkjtiWlHg7Ug

Given a positive integer n(n≤40), pick n-1 numbers randomly from 1 to n and concatenate them in random order  as a string s, which means there is a missing number between 1 and n. Can you find the missing number?(Notice that in some cases the answer will not be unique, and in these cases you only need to find one valid answer.)

Examples:

Input:  20 
81971112205101569183132414117 Output: 16

 //使用回溯法,这是我不太会,明天看一下。

原文地址:https://www.cnblogs.com/BlueBlueSea/p/9535731.html