###[Interview question]:
Write a program/pseudo code which list out all the possible combinations of this regular expression:
[0-9a-z]{6}
| #!/usr/bin/env ruby | |
| # It is a base 36 number system | |
| # 6 digit means 36^6 different combination | |
| 0.upto(36 ** 6 - 1) do |n| | |
| # to_s(36) convert the number to base 36 system | |
| # rjust(6, '0') pad 0 for the number less than 6 digit | |
| puts n.to_s(36).rjust(6, '0') | |
| end |