public List<String> findStrobogrammatic(int n) {
List<String> res = new ArrayList<>();
char[] num1 = {'0', '1', '8', '6', '9'};
char[] num2 = {'0', '1', '8', '9', '6'};
char[] buffer = new char[n];
dfs(buffer, num1, num2, res, 0);
public void dfs(char[] buffer, char[] num1, char[] num2, List<String> res, int index) {
int right = buffer.length - index - 1;
res.add(new String(buffer));
// We can only fill in 0, 1, 8 in the middle index
for (int i = 0; i < 3; i++) {
dfs(buffer, num1, num2, res, index + 1);
for (int i = 0; i < num1.length; i++) {
// First digit can not be 0
if (index == 0 && i == 0) {
dfs(buffer, num1, num2, res, index + 1);