-
-
Save mooreniemi/2a00e89725d8b6884b28fcc9572d0163 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run options: include {:locations=>{"./spec/string_permutations_iterative_spec.rb"=>[13]}} | |
String | |
#permutations | |
op_count: 1 | |
op: + A | |
current strings: [] | |
current stack: ["A:BC"] | |
----------- | |
op_count: 2 | |
op: + B | |
current strings: [] | |
current stack: ["A:BC", "B:AC"] | |
----------- | |
op_count: 3 | |
op: + C | |
current strings: [] | |
current stack: ["A:BC", "B:AC", "C:AB"] | |
----------- | |
op_count: 4 | |
op: C + A | |
current strings: [] | |
current stack: ["A:BC", "B:AC", "CA:B"] | |
----------- | |
op_count: 5 | |
op: C + B | |
current strings: [] | |
current stack: ["A:BC", "B:AC", "CA:B", "CB:A"] | |
----------- | |
op_count: 6 | |
op: CB + A | |
current strings: [] | |
current stack: ["A:BC", "B:AC", "CA:B", "CBA:"] | |
----------- | |
op_count: 7 | |
op: CA + B | |
current strings: ["CBA"] | |
current stack: ["A:BC", "B:AC", "CAB:"] | |
----------- | |
op_count: 8 | |
op: B + A | |
current strings: ["CBA", "CAB"] | |
current stack: ["A:BC", "BA:C"] | |
----------- | |
op_count: 9 | |
op: B + C | |
current strings: ["CBA", "CAB"] | |
current stack: ["A:BC", "BA:C", "BC:A"] | |
----------- | |
op_count: 10 | |
op: BC + A | |
current strings: ["CBA", "CAB"] | |
current stack: ["A:BC", "BA:C", "BCA:"] | |
------------ | |
op_count: 11 | |
op: BA + C | |
current strings: ["CBA", "CAB", "BCA"] | |
current stack: ["A:BC", "BAC:"] | |
------------ | |
op_count: 12 | |
op: A + B | |
current strings: ["CBA", "CAB", "BCA", "BAC"] | |
current stack: ["AB:C"] | |
------------ | |
op_count: 13 | |
op: A + C | |
current strings: ["CBA", "CAB", "BCA", "BAC"] | |
current stack: ["AB:C", "AC:B"] | |
------------ | |
op_count: 14 | |
op: AC + B | |
current strings: ["CBA", "CAB", "BCA", "BAC"] | |
current stack: ["AB:C", "ACB:"] | |
------------ | |
op_count: 15 | |
op: AB + C | |
current strings: ["CBA", "CAB", "BCA", "BAC", "ACB"] | |
current stack: ["ABC:"] | |
------------ | |
returns all permutations of a length 3 string | |
Finished in 0.00277 seconds (files took 0.26238 seconds to load) | |
1 example, 0 failures |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment