摘要:
RT:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that there will be only one unique solution.A sudoku puzzle......and its solution numbers marked in red.代码如下:不过有一个前提,有3×3的小方格内也必须满足不能出现相同数字的约定,所以回溯的时候加上了一个 阅读全文
摘要:
RT,给定字符串s1,s2判断能否通过重排列 s1 s2从而产生s3.注意s1 s2中字符的相对顺序不能变。如: s1 = abc s2 = def s3 = abcdef return true s3 = adefbc return true s3 = aefdbc return false思路:1.递归,很简单的思路,代码如下: bool Can(string s1, string s2, string s3) { if (s3.size() != s1.size() + s2.size()) return false; ... 阅读全文