Skip to main content
added 106 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 155
  • 394

05AB1E, 55 4 bytes

āÈ>×J€Ðιθ 

InputI/O as a list of characters, which is allowed by default.

I have the feeling 4 bytes might beI have the feeling 4 bytes might be possible, but I'm unable to find it.
It is possible, but I'm unableby porting @emanresuA's Vyxal answer (so make sure to find itupvote him/her as well).

Try it online.Try it online.

Explanation:

ā # Take the (implicit) input-list, and push a list in the range [1,example input-length]  # i.e.= ["a","b","c","d","e"] → [1,2,3,4,5])  È €Ð # Check forTriplicate each value in this list whether it's evencharacter (1 ifwhich truthy;remains 0a ifflattened falseylist)   # → [0["a",1"a",0"a",1"b",0]"b","b","c","c","c","d","d","d","e","e","e"]   > ι # Increase each value by 1 (thus 2Uninterleave ifthis truthy;list 1into iftwo falsey)parts   # → [1[["a",2"a",1"b",2"c",1]"c","d","e","e"],["a","b","b","c","d","d","e"]]   × θ # RepeatPop eachand characterleave injust the input-list that manysecond timespart   # → ["a","bb""b","b","c","dd""d","d","e"] J # And join the list together to a single string # → "abbcdde" # (after which this is output implicitly as result) 

05AB1E, 5 bytes

āÈ>×J 

Input as a list of characters, which is allowed by default.

I have the feeling 4 bytes might be possible, but I'm unable to find it.

Try it online.

Explanation:

ā # Take the (implicit) input-list, and push a list in the range [1, input-length]  # i.e. ["a","b","c","d","e"] → [1,2,3,4,5]  È  # Check for each value in this list whether it's even (1 if truthy; 0 if falsey)   # → [0,1,0,1,0]   > # Increase each value by 1 (thus 2 if truthy; 1 if falsey)   # → [1,2,1,2,1]   × # Repeat each character in the input-list that many times   # → ["a","bb","c","dd","e"] J # And join the list together to a single string # → "abbcdde" # (after which this is output implicitly) 

05AB1E, 5 4 bytes

€Ðιθ 

I/O as a list of characters, which is allowed by default.

I have the feeling 4 bytes might be possible, but I'm unable to find it.
It is possible, by porting @emanresuA's Vyxal answer (so make sure to upvote him/her as well).

Try it online.

Explanation:

 # (example input = ["a","b","c","d","e"]) €Ð # Triplicate each character (which remains a flattened list) # → ["a","a","a","b","b","b","c","c","c","d","d","d","e","e","e"] ι # Uninterleave this list into two parts # → [["a","a","b","c","c","d","e","e"],["a","b","b","c","d","d","e"]] θ # Pop and leave just the second part # → ["a","b","b","c","d","d","e"] # (which is output implicitly as result) 
Commonmark migration
Source Link

#05AB1E, 5 bytes

05AB1E, 5 bytes

āÈ>×J 

Input as a list of characters, which is allowed by default.

I have the feeling 4 bytes might be possible, but I'm unable to find it.

Try it online.

Explanation:

ā # Take the (implicit) input-list, and push a list in the range [1, input-length] # i.e. ["a","b","c","d","e"] → [1,2,3,4,5] È # Check for each value in this list whether it's even (1 if truthy; 0 if falsey) # → [0,1,0,1,0] > # Increase each value by 1 (thus 2 if truthy; 1 if falsey) # → [1,2,1,2,1] × # Repeat each character in the input-list that many times # → ["a","bb","c","dd","e"] J # And join the list together to a single string # → "abbcdde" # (after which this is output implicitly) 

#05AB1E, 5 bytes

āÈ>×J 

Input as a list of characters, which is allowed by default.

I have the feeling 4 bytes might be possible, but I'm unable to find it.

Try it online.

Explanation:

ā # Take the (implicit) input-list, and push a list in the range [1, input-length] # i.e. ["a","b","c","d","e"] → [1,2,3,4,5] È # Check for each value in this list whether it's even (1 if truthy; 0 if falsey) # → [0,1,0,1,0] > # Increase each value by 1 (thus 2 if truthy; 1 if falsey) # → [1,2,1,2,1] × # Repeat each character in the input-list that many times # → ["a","bb","c","dd","e"] J # And join the list together to a single string # → "abbcdde" # (after which this is output implicitly) 

05AB1E, 5 bytes

āÈ>×J 

Input as a list of characters, which is allowed by default.

I have the feeling 4 bytes might be possible, but I'm unable to find it.

Try it online.

Explanation:

ā # Take the (implicit) input-list, and push a list in the range [1, input-length] # i.e. ["a","b","c","d","e"] → [1,2,3,4,5] È # Check for each value in this list whether it's even (1 if truthy; 0 if falsey) # → [0,1,0,1,0] > # Increase each value by 1 (thus 2 if truthy; 1 if falsey) # → [1,2,1,2,1] × # Repeat each character in the input-list that many times # → ["a","bb","c","dd","e"] J # And join the list together to a single string # → "abbcdde" # (after which this is output implicitly) 
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 155
  • 394

#05AB1E, 5 bytes

āÈ>×J 

Input as a list of characters, which is allowed by default.

I have the feeling 4 bytes might be possible, but I'm unable to find it.

Try it online.

Explanation:

ā # Take the (implicit) input-list, and push a list in the range [1, input-length] # i.e. ["a","b","c","d","e"] → [1,2,3,4,5] È # Check for each value in this list whether it's even (1 if truthy; 0 if falsey) # → [0,1,0,1,0] > # Increase each value by 1 (thus 2 if truthy; 1 if falsey) # → [1,2,1,2,1] × # Repeat each character in the input-list that many times # → ["a","bb","c","dd","e"] J # And join the list together to a single string # → "abbcdde" # (after which this is output implicitly)