God's algorithm is a notion originating in discussions of ways to solve the Rubik's Cube puzzle, but which can also be applied to other combinatorial puzzles and mathematical games. It refers to any algorithm which produces a solution having the fewest possible moves (i.e., the solver should not require any more than this number). The allusion to the deity is based on the notion that an omniscient being would know an optimal step from any given configuration.