Skip to main content
added 2 characters in body
Source Link
DJMcMayhem
  • 60.1k
  • 18
  • 203
  • 352

Brain-Flak, 153 bytes

{(({})<>[({})])(({}({}))[({}[{}])])<>(([{}]({})))([({}<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}{{}({}<>{}())((<>))}{}{}}{}<>{}([]){{}({}<>)<>([])}<> 

Try it online!

This includes +1 for the -r flag.

#While True { #Magic#Push the last value left in the array minus the counter onto the alternate stack (({})<>[({})]) #Swap#Put the counter back on top of the alternate stack (({}({}))[({}[{}])]) #Toggle <> Find#Find the difference between the last two inputs left on the stackarray (([{}]({}))) Greater#Greater than or equal to 0? ([({}<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{} #If So: { #Pop the truthy/falsy value {} #Increment the counter by the difference between elements +1 ({}<>{}()) #Push two falsys ((<>)) #Endwhile } #Pop the two falsys {}{} #Endwhile } #Pop the falsy {} #Toggle back <> #Pop the counter #Reverse the stack {} ([]){{}({}<>)<>([])}<> 

Brain-Flak, 153 bytes

{(({})<>[({})])(({}({}))[({}[{}])])<>(([{}]({})))([({}<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}{{}({}<>{}())((<>))}{}{}}{}<>{}([]){{}({}<>)<>([])}<> 

Try it online!

This includes +1 for the -r flag.

#While True { #Magic (({})<>[({})]) #Swap (({}({}))[({}[{}])]) #Toggle <> Find the difference between the last two inputs on the stack (([{}]({}))) Greater than or equal to 0? ([({}<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{} #If So: { #Pop the truthy/falsy value {} #Increment the counter by the difference between elements +1 ({}<>{}()) #Push two falsys ((<>)) #Endwhile } #Pop the two falsys {}{} #Endwhile } #Pop the falsy {} #Toggle back <> #Pop the counter #Reverse the stack {} ([]){{}({}<>)<>([])}<> 

Brain-Flak, 153 bytes

{(({})<>[({})])(({}({}))[({}[{}])])<>(([{}]({})))([({}<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}{{}({}<>{}())((<>))}{}{}}{}<>{}([]){{}({}<>)<>([])}<> 

Try it online!

This includes +1 for the -r flag.

#While True { #Push the last value left in the array minus the counter onto the alternate stack (({})<>[({})]) #Put the counter back on top of the alternate stack (({}({}))[({}[{}])]) #Toggle <> #Find the difference between the last two inputs left on the array (([{}]({}))) #Greater than or equal to 0? ([({}<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{} #If So: { #Pop the truthy/falsy value {} #Increment the counter by the difference between elements +1 ({}<>{}()) #Push two falsys ((<>)) #Endwhile } #Pop the two falsys {}{} #Endwhile } #Pop the falsy {} #Toggle back <> #Pop the counter #Reverse the stack {} ([]){{}({}<>)<>([])}<> 
Source Link
DJMcMayhem
  • 60.1k
  • 18
  • 203
  • 352

Brain-Flak, 153 bytes

{(({})<>[({})])(({}({}))[({}[{}])])<>(([{}]({})))([({}<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}{{}({}<>{}())((<>))}{}{}}{}<>{}([]){{}({}<>)<>([])}<> 

Try it online!

This includes +1 for the -r flag.

#While True { #Magic (({})<>[({})]) #Swap (({}({}))[({}[{}])]) #Toggle <> Find the difference between the last two inputs on the stack (([{}]({}))) Greater than or equal to 0? ([({}<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{} #If So: { #Pop the truthy/falsy value {} #Increment the counter by the difference between elements +1 ({}<>{}()) #Push two falsys ((<>)) #Endwhile } #Pop the two falsys {}{} #Endwhile } #Pop the falsy {} #Toggle back <> #Pop the counter #Reverse the stack {} ([]){{}({}<>)<>([])}<>