Skip to main content
deleted 10 characters in body
Source Link
ngn
  • 15.3k
  • 2
  • 43
  • 87

K (ngn/k)K (ngn/k), 36 35 3537 bytes

{"()"(&|/-1<+\1'0>+\'1-2*)#_(x=+/')#+!2|&2*x}

Try it online!Try it online!

+!2|&2*x all binary vectors of length 2*n

(x=+/')# only those that sum to n

(&|/-1<+\10>+\'1-2*)#_ only those whose partial sums, treating 0/1 as 1/-1, are nowhere negative

"()" use 0/1 as indices in this string

K (ngn/k), 36 35 bytes

{"()"(&/-1<+\1-2*)#(x=+/)#+!2|&2*x}

Try it online!

+!2|&2*x all binary vectors of length 2*n

(x=+/)# only those that sum to n

(&/-1<+\1-2*)# only those whose partial sums, treating 0/1 as 1/-1, are nowhere negative

"()" use 0/1 as indices in this string

K (ngn/k), 36 35 37 bytes

{"()"(|/'0>+\'1-2*)_(x=+/')#+!2|&2*x}

Try it online!

+!2|&2*x all binary vectors of length 2*n

(x=+/')# only those that sum to n

(|/0>+\'1-2*)_ only those whose partial sums, treating 0/1 as 1/-1, are nowhere negative

"()" use 0/1 as indices in this string

-1
Source Link
ngn
  • 15.3k
  • 2
  • 43
  • 87

K (ngn/k)K (ngn/k), 3636 35 bytes

{"()"(&/-1<+\1-2*)#(x=+/)#+!(2*x)#22|&2*x}

Try it online!Try it online!

+!(2*x)#22|&2*x all binary vectors of length 2*n

(x=+/)# only those that sum to n

(&/-1<+\1-2*)# only those whose partial sums, treating 0/1 as 1/-1, are nowhere negative

"()" use 0/1 as indices in this string

K (ngn/k), 36 bytes

{"()"(&/-1<+\1-2*)#(x=+/)#+!(2*x)#2}

Try it online!

+!(2*x)#2 all binary vectors of length 2*n

(x=+/)# only those that sum to n

(&/-1<+\1-2*)# only those whose partial sums, treating 0/1 as 1/-1, are nowhere negative

"()" use 0/1 as indices in this string

K (ngn/k), 36 35 bytes

{"()"(&/-1<+\1-2*)#(x=+/)#+!2|&2*x}

Try it online!

+!2|&2*x all binary vectors of length 2*n

(x=+/)# only those that sum to n

(&/-1<+\1-2*)# only those whose partial sums, treating 0/1 as 1/-1, are nowhere negative

"()" use 0/1 as indices in this string

added 212 characters in body
Source Link
ngn
  • 15.3k
  • 2
  • 43
  • 87

K (ngn/k), 36 bytes

{"()"(&/-1<+\1-2*)#(x=+/)#+!(2*x)#2}

Try it online!

+!(2*x)#2 all binary vectors of length 2*n

(x=+/)# only those that sum to n

(&/-1<+\1-2*)# only those whose partial sums, treating 0/1 as 1/-1, are nowhere negative

"()" use 0/1 as indices in this string

K (ngn/k), 36 bytes

{"()"(&/-1<+\1-2*)#(x=+/)#+!(2*x)#2}

Try it online!

K (ngn/k), 36 bytes

{"()"(&/-1<+\1-2*)#(x=+/)#+!(2*x)#2}

Try it online!

+!(2*x)#2 all binary vectors of length 2*n

(x=+/)# only those that sum to n

(&/-1<+\1-2*)# only those whose partial sums, treating 0/1 as 1/-1, are nowhere negative

"()" use 0/1 as indices in this string

Source Link
ngn
  • 15.3k
  • 2
  • 43
  • 87
Loading