Skip to main content
added 4 characters in body
Source Link

Ruby, 55 53 47 45 3637 bytes

  • -2 bytes thanks to Dingus
  • -98 bytes thanks to G B
f=->s,a=1{s&&[s[0,a],f[s[a*f[s[a..],a+a]]}

Attempt This Online!Attempt This Online!

@OP just to let you know, the easy tasks are welcome! :)

A recursive function with 2 variables: the original string and the counter. The function chops a string piece, adds it to the unnamed output vector and updates the counter until the string is empty.

Ruby, 55 53 47 45 36 bytes

  • -2 bytes thanks to Dingus
  • -9 bytes thanks to G B
f=->s,a=1{s&&[s[0,a],f[s[a..],a+a]]}

Attempt This Online!

@OP just to let you know, the easy tasks are welcome! :)

A recursive function with 2 variables: the original string and the counter. The function chops a string piece, adds it to the unnamed output vector and updates the counter until the string is empty.

Ruby, 55 53 47 45 37 bytes

  • -2 bytes thanks to Dingus
  • -8 bytes thanks to G B
f=->s,a=1{s&&[s[0,a],*f[s[a..],a+a]]}

Attempt This Online!

@OP just to let you know, the easy tasks are welcome! :)

A recursive function with 2 variables: the original string and the counter. The function chops a string piece, adds it to the unnamed output vector and updates the counter until the string is empty.

added 5 characters in body
Source Link

Ruby, 55 53 47 45 36 bytes

  • -2 bytes thanks to Dingus
  • -9 bytes thanks to G B
f=->s,a=1{s&&[s[0,a],f[s[a..],a+a]]}

Attempt This Online!

@OP just to let you know, the easy tasks are welcome! :)

A recursive function with 2 variables: the original string and the counter. The function chops a string piece, adds it to the unnamed output vector and updates the counter until the string is empty.

Ruby, 55 53 47 45 36 bytes

  • -2 bytes thanks to Dingus
  • -9 bytes thanks to G B
f=->s,a=1{s&&[s[0,a],f[s[a..],a+a]]}

Attempt This Online!

@OP just to let you know, the easy tasks are welcome! :)

A recursive function with 2 variables: the original string and the counter. The function chops a string piece, it to the unnamed output vector and updates the counter until the string is empty.

Ruby, 55 53 47 45 36 bytes

  • -2 bytes thanks to Dingus
  • -9 bytes thanks to G B
f=->s,a=1{s&&[s[0,a],f[s[a..],a+a]]}

Attempt This Online!

@OP just to let you know, the easy tasks are welcome! :)

A recursive function with 2 variables: the original string and the counter. The function chops a string piece, adds it to the unnamed output vector and updates the counter until the string is empty.

added 216 characters in body
Source Link

Ruby, 55 53 47 4545 36 bytes

  • -2 bytes thanks to Dingus
  • -9 bytes thanks to G B
f=->s,v=[],a=1{s ?s&&[s[0,a],f[s[a..],v<<s[...a],a*2]:va+a]]}

Attempt This Online!Attempt This Online!

@OP just to let you know, the easy tasks are welcome! :)

I have build a recursionA recursive function with three2 variables: the original string, the output vector and the counter. The function chops a string piece, adds it to the unnamed output vector and updates the counter until the string is empty.

Ruby, 55 53 47 45 bytes

f=->s,v=[],a=1{s ?f[s[a..],v<<s[...a],a*2]:v}

Attempt This Online!

@OP just to let you know, the easy tasks are welcome! :)

I have build a recursion with three variables: the original string, the output vector and the counter. The function chops a string piece, adds it to vector and updates the counter until the string is empty.

Ruby, 55 53 47 45 36 bytes

  • -2 bytes thanks to Dingus
  • -9 bytes thanks to G B
f=->s,a=1{s&&[s[0,a],f[s[a..],a+a]]}

Attempt This Online!

@OP just to let you know, the easy tasks are welcome! :)

A recursive function with 2 variables: the original string and the counter. The function chops a string piece, it to the unnamed output vector and updates the counter until the string is empty.

added 93 characters in body
Source Link
Loading
deleted 241 characters in body
Source Link
Loading
added 5 characters in body
Source Link
Loading
added 240 characters in body
Source Link
Loading
deleted 3 characters in body
Source Link
Loading
Source Link
Loading