Skip to content

Instantly share code, notes, and snippets.

@HumanEquivalentUnit
Created August 1, 2020 15:19
Show Gist options
  • Save HumanEquivalentUnit/175fe4c843581e3a034f1b4e3dbc2489 to your computer and use it in GitHub Desktop.
Save HumanEquivalentUnit/175fe4c843581e3a034f1b4e3dbc2489 to your computer and use it in GitHub Desktop.
Dyalog APL Competition 2020 - Phase I solutions
((0>⊣)⌽((⊂↑),(⊂↓))) ⍝ 1. Let's Split
(⊢⊂⍨(128∘>∨191∘<)) ⍝ 2. Characters
{26⊥⎕A⍳⍵} ⍝ 3. Columns
{(0=400|⍵)∨(≠⌿0=4 100∘.|⍵)} ⍝ 4. Take a Leap
{⎕IO←0 ⋄ ⌽⍣(>/⍵)⊢(⌊/⍵)+⍳1+(⌈/-⌊/)⍵} ⍝ 5. Stepping
{⍵[⍒⍺=⍵]} ⍝ 6. Move To Front
{⍺=2⊥bits∧⍺⊤⍨2⍴⍨≢bits←2⊥⍣¯1⊢⍵} ⍝ 7. Bits
{(∨/(1 ¯1⍴⍨≢)⍷⍨(×2-/⊢))10⊥⍣¯1⊢⍵} ⍝ 8. Zigzag
{peak←(⊢⍳⌈/),⍵ ⋄ notDesc←(⍳∘≢≡⍋) ⋄ (notDesc peak↑⍵) ∧ (notDesc ⌽peak↓⍵)} ⍝ 9. Rise and fall
⍝ 10. Stacking It Up - not done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment