Skip to main content
jqplay
Source Link
peak
  • 145
  • 4

jq (74 bytes)

Since shortness is the goal ...

def f:def i:.,(i|[0]+.,[1]+.);nth(.-1;[1]|i|select(index([1,1])|not))+[1]; 

Example:

65|f #=> [0,1,0,0,1,0,0,0,1,1] 

Try it onlineTry it online

jq (74 bytes)

Since shortness is the goal ...

def f:def i:.,(i|[0]+.,[1]+.);nth(.-1;[1]|i|select(index([1,1])|not))+[1]; 

Example:

65|f #=> [0,1,0,0,1,0,0,0,1,1] 

Try it online

jq (74 bytes)

Since shortness is the goal ...

def f:def i:.,(i|[0]+.,[1]+.);nth(.-1;[1]|i|select(index([1,1])|not))+[1]; 

Example:

65|f #=> [0,1,0,0,1,0,0,0,1,1] 

Try it online

misplaced left paren
Source Link
peak
  • 145
  • 4

jq (74 bytes)

Since shortness is the goal ...

def f:def i:.,i|([0]+i|[0]+.,[1]+.);nth(.-1;[1]|i|select(index([1,1])|not))+[1]; 

Example:

65|f #=> [0,1,0,0,1,0,0,0,1,1] 

Try it online

jq (74 bytes)

Since shortness is the goal ...

def f:def i:.,i|([0]+.,[1]+.);nth(.-1;[1]|i|select(index([1,1])|not))+[1]; 

Example:

65|f #=> [0,1,0,0,1,0,0,0,1,1] 

Try it online

jq (74 bytes)

Since shortness is the goal ...

def f:def i:.,(i|[0]+.,[1]+.);nth(.-1;[1]|i|select(index([1,1])|not))+[1]; 

Example:

65|f #=> [0,1,0,0,1,0,0,0,1,1] 

Try it online

shave off ()
Source Link
peak
  • 145
  • 4

jq (7674 bytes)

Since shortness is the goal ...

def f:def i:.,(i|([0]+.,[1]+.));nth(.-1;[1]|i|select(index([1,1])|not))+[1]; 

Example:

65|f #=> [0,1,0,0,1,0,0,0,1,1] 

Try it online

jq (76 bytes)

Since shortness is the goal ...

def f:def i:.,(i|([0]+.,[1]+.));nth(.-1;[1]|i|select(index([1,1])|not))+[1]; 

Example:

65|f #=> [0,1,0,0,1,0,0,0,1,1] 

Try it online

jq (74 bytes)

Since shortness is the goal ...

def f:def i:.,i|([0]+.,[1]+.);nth(.-1;[1]|i|select(index([1,1])|not))+[1]; 

Example:

65|f #=> [0,1,0,0,1,0,0,0,1,1] 

Try it online

shortness
Source Link
peak
  • 145
  • 4
Loading
Source Link
peak
  • 145
  • 4
Loading