Skip to content

APL Quest 2020 Problems

2020-1: Let's Split!:

Write a function that, given a right argument `Y` which is a scalar or a non-empty vector and a left argument `X` which is a single non-zero integer so that its absolute value is less or equal to `≢Y`, splits `Y` into a vector of two vectors according to `X`.

2020-2: Character Building:

Write a function that, given a right argument which is a simple integer vector representing valid UTF-8 text, encloses each sequence of integers that represent a single character, like the result of `'UTF-8'∘⎕UCS¨'UTF-8'∘⎕UCS` but does not use any system functions (names beginning with `⎕`).

2020-3: Excel-lent Columns:

Write a function that, given a right argument which is a character scalar or non-empty vector representing a valid character Excel column identifier between A and XFD, returns the corresponding column number.

2020-4: Take a Leap:

Write a function that, given a right argument which is an integer array of year numbers greater than or equal to 1752 and less than 4000, returns a result of the same shape as the right argument where 1 indicates that the corresponding year is a leap year (0 otherwise).

2020-5: Stepping in the Proper Direction:

Write a function that, given a right argument of 2 integers, returns a vector of the integers from the first element of the right argument to the second, inclusively.

2020-6: Move to the Front:

Write a function that, given a right argument which is an integer vector and a left argument which is an integer scalar, reorders the right argument so any elements equal to the left argument come first while all other elements keep their order.

2020-7: See You in a Bit:

Write a function that, given a non-negative right argument which is an integer scalar representing the encoded state and a left argument which is an integer scalar representing the encoded state settings that you want to query, returns 1 if all of the codes in the left argument are found in the right argument (0 otherwise).

2020-8: Zigzag Numbers:

Write a function that takes a single integer greater than or equal to 100 and less than 10¹⁵ as its right argument and returns a 1 if the integer is a zigzag number, 0 otherwise.

2020-9: Rise and Fall:

Write a function that, given a right argument which is an integer scalar or vector, returns a 1 if the values of the right argument conform to the given pattern (0 otherwise).

2020-10: Stacking It Up:

Write a function that takes as its right argument a vector of simple arrays of rank 2 or less (scalar, vector, or matrix) and returns a simple character array that displays identically to what `{⎕←⍵}¨` displays when applied to the right argument.