Skip to main content
added 122 characters in body
Source Link
Asone Tuhid
  • 2.4k
  • 8
  • 22

Ruby, 7373 64 bytes

->s,n{c=s.chars;(10...n).flat_map{|i|[*s.charsc.repeated_permutationproduct(i*[c]*_1)]}.map{_1*''}}

66 byte version because TIO doesn't support _1

->s,n{c=s.chars;(0...n).flat_map{|i|c.product(*[c]*i)}.map &:join)}

Try it online!Try it online!

Ruby, 73 bytes

->s,n{(1..n).flat_map{|i|[*s.chars.repeated_permutation(i)]}.map(&:join)}

Try it online!

Ruby, 73 64 bytes

->s,n{c=s.chars;(0...n).flat_map{c.product(*[c]*_1)}.map{_1*''}}

66 byte version because TIO doesn't support _1

->s,n{c=s.chars;(0...n).flat_map{|i|c.product(*[c]*i)}.map &:join}

Try it online!

Source Link
Asone Tuhid
  • 2.4k
  • 8
  • 22

Ruby, 73 bytes

->s,n{(1..n).flat_map{|i|[*s.chars.repeated_permutation(i)]}.map(&:join)}

Try it online!