Skip to main content
Commonmark migration
Source Link

#Python 2, 49 48 bytes

Python 2, 49 48 bytes

g=lambda s,n:n and g(s[0]+s[2:-2]+s[-1],n-1)or s

Try it here with testcases!

Simple recursive solution. Removes the second and last second element from the input string and calls itself with this and n-1 until n=0.

edit: Feeling kinda stupid, looking at the other python solution. Guess I just like recursion too much...

#Python 2, 49 48 bytes

g=lambda s,n:n and g(s[0]+s[2:-2]+s[-1],n-1)or s

Try it here with testcases!

Simple recursive solution. Removes the second and last second element from the input string and calls itself with this and n-1 until n=0.

edit: Feeling kinda stupid, looking at the other python solution. Guess I just like recursion too much...

Python 2, 49 48 bytes

g=lambda s,n:n and g(s[0]+s[2:-2]+s[-1],n-1)or s

Try it here with testcases!

Simple recursive solution. Removes the second and last second element from the input string and calls itself with this and n-1 until n=0.

edit: Feeling kinda stupid, looking at the other python solution. Guess I just like recursion too much...

replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

#Python 2, 49 48 bytes

g=lambda s,n:n and g(s[0]+s[2:-2]+s[-1],n-1)or s

Try it here with testcases!

Simple recursive solution. Removes the second and last second element from the input string and calls itself with this and n-1 until n=0.

edit: Feeling kinda stupid, looking at the other python solutionthe other python solution. Guess I just like recursion too much...

#Python 2, 49 48 bytes

g=lambda s,n:n and g(s[0]+s[2:-2]+s[-1],n-1)or s

Try it here with testcases!

Simple recursive solution. Removes the second and last second element from the input string and calls itself with this and n-1 until n=0.

edit: Feeling kinda stupid, looking at the other python solution. Guess I just like recursion too much...

#Python 2, 49 48 bytes

g=lambda s,n:n and g(s[0]+s[2:-2]+s[-1],n-1)or s

Try it here with testcases!

Simple recursive solution. Removes the second and last second element from the input string and calls itself with this and n-1 until n=0.

edit: Feeling kinda stupid, looking at the other python solution. Guess I just like recursion too much...

added 9 characters in body
Source Link
Denker
  • 6.9k
  • 1
  • 24
  • 67

#Python 2, 4949 48 bytes

g=lambda s,n:n and g(s[0]+s[2:-2]+s[-1],n-1)if n elseor s

Try it here with testcases!Try it here with testcases!

Simple recursive solution. Removes the second and last second element from the input string and calls itself with this and n-1 until n=0.

edit: Feeling kinda stupid, looking at the other python solution. Guess I just like recursion too much...

#Python 2, 49 bytes

g=lambda s,n:g(s[0]+s[2:-2]+s[-1],n-1)if n else s

Try it here with testcases!

Simple recursive solution. Removes the second and last second element from the input string and calls itself with this and n-1 until n=0.

edit: Feeling kinda stupid, looking at the other python solution. Guess I just like recursion too much...

#Python 2, 49 48 bytes

g=lambda s,n:n and g(s[0]+s[2:-2]+s[-1],n-1)or s

Try it here with testcases!

Simple recursive solution. Removes the second and last second element from the input string and calls itself with this and n-1 until n=0.

edit: Feeling kinda stupid, looking at the other python solution. Guess I just like recursion too much...

added 176 characters in body
Source Link
Denker
  • 6.9k
  • 1
  • 24
  • 67
Loading
Source Link
Denker
  • 6.9k
  • 1
  • 24
  • 67
Loading