LeetCode:
Implement pow(x, n).
Solution: Binary Search
'Q' and '.' both indicate a queen and an empty space respectively.[ [".Q..", // Solution 1 "...Q", "Q...", "..Q."], ["..Q.", // Solution 2 "Q...", "...Q", ".Q.."] ]
Slution: DFS
"11""1""100".Input:Digit string "23" Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
Solution: DFS, Helper table
1->2->3->4->5->NULL, m = 2 and n = 4,1->4->3->2->5->NULL.1,2,3 → 1,3,23,2,1 → 1,2,31,1,5 → 1,5,1
[1,1,2] have the following unique permutations:[1,1,2], [1,2,1], and [2,1,1].1->2->3->3->4->4->5, return 1->2->5.1->1->1->2->3, return 2->3.