I'm trying to take a string, and return all possible permutations without shifting order. For example:
string_array = ["abc"]
empty_array = []
string_array.each do |element|
for i in (0..(element.length-1)) do
empty_array.push(element[0..i])
i += 1
end
end
something like this would give ['a', 'ab', 'abc'].
However, I need ['a', 'ab', 'abc', 'b', 'bc', 'c'].
Is there anyway of modifying my code to include this?