Skip to content

Instantly share code, notes, and snippets.

@adam-nathan
Last active July 18, 2022 13:02
Show Gist options
  • Save adam-nathan/9b7bb1e38cb573f8e99ae3543aa4902c to your computer and use it in GitHub Desktop.
Save adam-nathan/9b7bb1e38cb573f8e99ae3543aa4902c to your computer and use it in GitHub Desktop.
leet in APL
q1920 {⎕IO0 ()}
q1672 /+/
q1431 {0+-/}
q1512 +/=/((()(.<)))
q1470 {,2,2÷}
q0771 +/jewels . stones
q0414 3(nums[nums] nums), /nums
q0053 /.-0,+\nums
q0058 ¯1' 's
q0228 {¨,1 ¯1.-}
q0122 {+/0¯2-/}
q1413 (/1,1-+\)
q1178 {+/.{(0=~)()}}
q0448 ~()
q0062 {¯1 (+\) 1}
q0668 k{[]},(m).×(n)
q0986 {(1),¯1}¨r/0<¨r,first .(to/) second
q0205 ()
q0986 {(02-/i) / 2,/ i() ,/ } first second
q0011 /(.height)×(.-height)
q0085 /,{×/, /( 1) matrix} ¨matrix brute force
q0349
q0152 /(×/¨) nums
q0542 /.(+/|-)~
q0310 {()~1=+/}() (edges 2/n)
q0476 2~2¯1
q0812 {0.5×/|det¨[2 3]1,[3 cmat]}
q0523 {/>/0=|.-+\}
q0974 {1(.<n)×0=|.-+\n0,}
q0532 {1=|-/(()1)[2 cmat]}
q0532 1+ k ≠ 0
q0560 {(1,)(.=(+))(+\)}
q0560 1((+)(+\))
q1930 1()1((3 cmat))s
q0136 2/(2¯1)
q0169 (1({/},))
q1915 +/{2>+/2|+/chars.=}¨(,/(,/¨))
q1029 +/(((⍋⍋)-/)1 2/2÷)¨
q1337 ⎕IO-k+/mat
q1558 (¯1+ + +/) (+/ 2 ¯1)
q0200 ¯1+, {/[2;2],0~/4 2} 3 3 @ grid
q0890 ¨(¨){/}
q0446 (+/ ((3 to ) ((1())1 (2-/) (cmat ( 0 1) ) )¨))
q0304 {+/sign×(++\)[(4 2(,(¯1⌽⌽))(+2/0 1))]}
q1710 +/truckSize ( ) //¨boxTypes
q0179 /¨1(({{1:, /,¨~¨}})1)
q1937 (/ ((.+-(|.-())) /))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment