Skip to content

Commit

Permalink
add restore ip addr
Browse files Browse the repository at this point in the history
  • Loading branch information
tg123 committed Aug 1, 2014
1 parent 745055d commit face4fb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions restore-ip-addresses/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
## Apply DFS pattern

## TODO
* write down thinking
See DFS pattern in [N-Queens](../n-queens)


* `steps`: 4 part of an ip-address
* `choices each step`: 1-3 chars from the string
* `possibility checker`: the number formed by chars should be less than or equals to 255

### When to use backtracking

In this case, I do not use `stack[pstack] = null` after starting to try another choice.

Because, the value in `stack[pstack]` will not affect any further choice. Rollbacking is not needed and the value will be overwrited.

0 comments on commit face4fb

Please sign in to comment.