1: Drop
2: Intersection
3: Min
4: Bounds
5: Replicate
6: Double
7: Doubles
8: Unique
9: Table
10: X
Your Answers
LocalStorage is disabled or you are using an old browser. Please register (and log in) to have your solutions saved.
APL Logo

Welcome to the APL Challenge!

The current round (2025.4) ends on Friday 30 January 2026 at 09:00 UTC.

APL is a programming language that will change the way you think about solving problems.

The APL Challenge has been made for those that don’t know APL yet. You don’t need to know any programming either. We’ll teach everything you need to know as you go along.

You don’t need to solve every problem, but every one you do, gives you a chance to win one of three USD 100 prizes. Winners are also listed on our website.

Solving the problems

You can use TryAPL to experiment and find a solution to each problem, then copy it onto the problem page. You can also just write a solution into the input field directly. Either way, you can write APL symbols by clicking on the language bar above the area where you write APL code.

Several problems include some data (text or numbers) you need. You should be able to copy data with an icon like this by clicking on it, but note that not all browsers allow this.

Testing and submitting your solutions

You don't need to register to start (most browsers will store your answers until you register) but you must be registered and logged in to submit your answers. However, you can test your answer using the  Test button.

You can test and submit your answer using the  Submit button. The system will only allow you to submit correct answers.

Prizes

After each round, Dyalog Ltd awards up to three USD 100 prizes.

Anyone can win a prize except Dyalog employees and associates. We reserve the right to choose the winners at our sole discretion and will not enter into conversation about our choices.

All prizes are denominated in U.S. dollars, but can be awarded in U.S. dollars (USD), pounds sterling (GBP) or euros (EUR) by electronic transfer to a bank account or a PayPal account. No other forms of payment will be made.

If you are selected as a winner but are unable or unwilling to accept the prize, you cannot transfer the prize or designate someone else as the winner. Prizes must be claimed within three weeks of being notified or you forfeit the right to that prize.

If you accept a prize, you will be solely responsible for all applicable taxes related to accepting that prize.

Detailed rules

Conditions

Each round stands on its own; participants can enter a single or multiple rounds independently.

All participants must submit to these rules.

Multiple registrations to a single round are not allowed.

Participants must not publish their solutions prior to the end of the challenge round. Doing so will be considered grounds for disqualification from the challenge round.

Only entries that are received by the deadline are eligible. We cannot accept responsibility for entries that are lost, delayed or damaged. Proof of sending an online entry is not proof that we received it.

Entries not submitted in accordance with these terms and all other rules and directions (at the sole discretion of Dyalog Ltd) will be excluded from the challenge round.

Frequently Asked Questions (FAQ)

I’m stuck. Can you help?

In fairness to all, we cannot provide guidance to specific issues. However, everything you need to know should be included either on the page of your current problem or on one of the previous problem pages.

Can I collaborate with my friends?

Yes. However, a submission can only be made by a single person and only that person will be eligible for a prize. Each collaborator can submit an entry.

Why is my correct answer not accepted?

The purpose of the APL Challenge is to teach specific parts of APL, so we require solutions that use the techniques we teach. Most problems can be solved in many ways, and the techniques we teach here do not necessarily lead to the best code. If you want to explore alternative answers, then you can use TryAPL to do so.

Why can I not change my answer?

When you test or submit a correct answer, we lock it down for you, so it isn’t accidentally overwritten with an incorrect answer. All correct answers are equally eligible for winning. If you want to explore alternative answers, then you can use TryAPL to do so.

Does the possibility of winning prize money classify as commercial use of Dyalog?

No.

I didn’t win a prize. Can I try again?

Yes. There are four rounds of the APL Challenge each year and each runs for three months. You are free to enter subsequent rounds whether or not you’ve participated in or won a prize in a previous round.

What do I do if there is a problem with this website?

Please report any problems to challenge@dyalog.com.

I did not receive an email with a code when registering. What should I do?

Click Register again and wait for 5–10 minutes. Make sure you check your spam folder. If the code still doesn't come through, then please report the problem to challenge@dyalog.com.

Data protection and cookies

We use cookies to keep you logged in and to retain your solutions. By using this site, you agree to this.

We only collect the data necessary for the competition to run, and will use any personal information submitted in accordance with Dyalog Ltd's Privacy Policy.

At any time after you have registered and are logged in, you can erase all data that is stored about you as part of the competition by clicking the user button email@domain.com in the top right corner and selecting Erase account and data.

Consent to usage of information

By participating in the challenge, you consent to the use by Dyalog Ltd of all text and code that you submit, for any purpose, in any media, for an unlimited period, without remuneration. We have the right to publish, display, reproduce, adapt, promote or otherwise use entries in any way we deem fit. You warrant that you are legally entitled to grant these rights to us and agree to indemnify us in the event that we suffer any loss as a result of false information you provide.

By participating in the challenge, you agree that if you win and subsequently participate in any promotional activities or material, you will do so without additional payment or permission.

Disclaimers

We are not liable for any damage, loss or disappointment suffered by you for taking part or not being able to take part in this competition.

In the event of unforeseen circumstances, we may alter, amend or cancel the competition without prior notice.

We reserve the right to change these terms at any time.

These terms are governed by the Laws of England and Wales and all disputes subject to the jurisdiction of the courts of England and Wales.

Contact

If you have feedback, or would like to ask a question that is not already answered here, please e-mail challenge@dyalog.com.

image/svg+xml
APL Challenge 2025.4

Note: In this problem, you’re asked to enter some APL code, including an APL symbol and the data (text or numbers) given to it. Your code will be tested by the APL Challenge system to check whether it gives the correct answer and uses the methods described below.


1: Drop

The symbol is used to drop items (the symbol hints at the direction that things fall when they are dropped). It takes a number on its left and a list on its right. The number specifies how many items to drop from the start of the list. For example, 1 ↓ 3 1 4 1 5 gives 1 4 1 5 and 3 ↓ 3 1 4 1 5 gives 1 5.

In APL, a text is a list of letters and must be between single quotes ( ' ). For example, 'ABC' will give a result that looks like ABC.


Write some APL code that uses to turn the text 'allocation' into 'location'.

Answer:Answer:

In this problem, you’re asked to enter some APL code, including an APL symbol and the data (text or numbers) given to it. Your code will be tested by the APL Challenge system to check whether it gives the correct answer and uses the methods described below.


2: Meet Me at the Intersection

The symbol is called Intersection (its shape is like the letter n of intersection). It takes one list on each side and gives a new list. The new list will have every item from the list on the left that is also found in the list on the right. For example, 3 1 4 1 5 ∩ 1 2 3 gives 3 1 1 because:

  • 3 is in the new list because it is found in 1 2 3
  • 1 is in the new list because it is found in 1 2 3
  • 4 is not in the new list because it is not found in 1 2 3
  • 1 is in the new list because it is found in 1 2 3
  • 5 is not in the new list because it is not found in 1 2 3

Similarly with text, 'Drake Mallard' ∩ 'dark' gives rakaard, because:

  • 'D' is not in the new list because it is not found in 'dark'
  • 'r' is in the new list because it is found in 'dark'
  • 'a' is in the new list because it is found in 'dark'
  • 'k' is in the new list because it is found in 'dark'
  • 'e' is not in the new list because it is not found in 'dark'
  • ' ' is not in the new list because it is not found in 'dark'
  • 'M' is not in the new list because it is not found in 'dark'
  • 'a' is in the new list because it is found in 'dark'
  • 'l' is not in the new list because it is not found in 'dark'
  • 'l' is not in the new list because it is not found in 'dark'
  • 'a' is in the new list because it is found in 'dark'
  • 'r' is in the new list because it is found in 'dark'
  • 'd' is in the new list because it is found in 'dark'

Write some APL code that uses to find the intersection of 'piece of cake' and 'aeiou'. The result should be ieeoae.

Answer:Answer:

In this problem, you’re asked to enter some APL code, including an APL symbol and the data (text or numbers) given to it. Your code will be tested by the APL Challenge system to check whether it gives the correct answer and uses the methods described below.


3: Minimalism

The symbol (Lowest) works out which of two numbers is the lowest (the symbol looks like a vertical line with a mark at the lowest point and also looks like the letter L in Lowest). Given a number on each side, it will give the one that has the lowest value. For example, 5 ⌊ 2 gives 2 because 2 is a lower value than 5.

Lowest – and all other basic mathematical symbols of APL – can work on lists of numbers. For example, 5 ⌊ 2 7 1 8 gives 2 5 1 5 because:

  • 5 ⌊ 2 gives 2 because 2 is lower than 5
  • 5 ⌊ 7 gives 5 because 5 is lower than 7
  • 5 ⌊ 1 gives 1 because 1 is lower than 5
  • 5 ⌊ 8 gives 5 because 5 is lower than 8

Write some APL code that uses a single to limit the numbers in the list 1 2 3 4 5 6 7 8 9 10 so that they are 7 or lower, that is, items with a higher value than 7 are replaced with the value 7. The result should be 1 2 3 4 5 6 7 7 7 7.

Answer:Answer:

Note: In this problem, you’re asked to enter an APL expression (some APL code), including arguments (data given to APL symbols). Your code will be tested by the APL Challenge system to check whether it gives the correct answer and uses the methods described below.


4: Staying In Bounds

Symbols that are used to change data are called functions.

The Highest function is just like Lowest from problem 3, except that it gives the higher value of corresponding items (the symbol provides a reminder because the mark is at the highest point of the vertical line). For example, 3 1 4 1 5 9 ⌈ 2 7 1 8 2 8 gives 3 7 4 8 5 9, because:

  • 3 ⌈ 2 gives 3 because 3 is higher than 2
  • 1 ⌈ 7 gives 7 because 7 is higher than 1
  • 4 ⌈ 1 gives 4 because 4 is higher than 1
  • 1 ⌈ 8 gives 8 because 8 is higher than 1
  • 5 ⌈ 2 gives 5 because 5 is higher than 2
  • 9 ⌈ 8 gives 9 because 9 is higher than 8

An APL function takes the result of all code to its right as its right argument (the data on the right of the symbol). For example, 2×3+4 gives 14 (rather than the 10 you might expect) because the × takes the result of 3+4 as its right argument. Similarly, -2-6 gives 4 because the left - negates the result of 2-6.


Write an expression that uses and to limit the numbers in the list 1 2 3 4 5 6 7 8 9 10 so that they are between 3 and 7, that is, items with a lower value than 3 are replaced with the value 3 and items with a higher value than 7 are replaced with the value 7. The result will be 3 3 3 4 5 6 7 7 7 7.

Answer:Answer:

In this problem, you’re asked to enter an APL expression (some APL code), including arguments (data given to APL symbols). Your code will be tested by the APL Challenge system to check whether it gives the correct answer and uses the methods described below.


5: Self Replication

The Copy function is used to make copies of items. It takes a list of numbers on its left and any list of equal length on its right. For each number in the list on the left, Copy puts that many copies of the corresponding item of the right argument into the result. For example, 2 0 3 1 2 3 ⌿ 'DYALOG' gives 'DDAAALOOGGG', because:

  • 2 copies of 'D' is 'DD'
  • 0 copies of 'Y' is ''
  • 3 copies of 'A' is 'AAA'
  • 1 copies of 'L' is 'L'
  • 2 copies of 'O' is 'OO'
  • 3 copies of 'G' is 'GGG'

The function (iota, a Greek letter) with a number on its right will give you all the whole numbers from 1 to the number that you gave it. (An iota is like an i for integers, which means whole numbers.) For example, ⍳ 7 gives 1 2 3 4 5 6 7

You can use round brackets to change the order in which things are calculated. In problem 4 you learnt that an APL function takes the result of all code to its right as its right argument. This was a simplification; the right argument only goes as far as the nearest closing bracket ) on its right:

  • 2×3+4 gives 14 because × takes the result of all code to its right, 3+4, as its right argument.
  • 2×(3+4) gives 14 because × takes the result of all code to its right, (3+4), as its right argument.
  • (2×3)+4 gives 10 because the right argument of × only goes as far as the nearest closing bracket.

Write an expression that uses , , brackets, and the number 5, and returns 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5.

Answer:Answer:

In this problem, you’re asked to enter an APL expression (some APL code), including arguments (data given to APL symbols). Your code will be tested by the APL Challenge system to check whether it gives the correct answer and uses the methods described below.


6: Double Vision

APL has several functions that compare the data on their left with the data on their on the right. They give 1 for yes and 0 for no when answering whether the statement is true. For example: Lower Than (<), Lower Than Or Equal To (), Equal To (=), Higher Than Or Equal To (), Higher Than (>).

These can compare entire lists. For example, 3 1 4 ≥ 2 1 7 gives 1 1 0 because:

  • 1: yes, 3 is bigger than than (or equal to) 2
  • 1: yes, 1 is (bigger than than or) equal to 1
  • 0: no, 4 is not bigger than than or equal to 7

If you put / (insert) immediately to the right of a function, then it inserts the function between the items of a list on its right. For example, you can use / to multiply all the numbers in a list: ×/ 1 2 3 4 gives 24 because it is the same as 1 × 2 × 3 × 4.

Remember from problem problem 1? If the number on its left is negative, then it will drop items from the end of the list on its right, rather than from the start.

You can use this to analyse the relationship between adjacent items. For example, let’s say that we have the list 3 1 4 1 5 9 and want to find out which items are higher than their predecessor. To do this:

  1. Drop the first and last items (separately), that is, 1 ↓ 3 1 4 1 5 9 and ¯1 ↓ 3 1 4 1 5 9 giving 1 4 1 5 9 and 3 1 4 1 5 respectively.
  2. Compare those two lists to find which of the corresponding items has the highest value: 1 4 1 5 9 > 3 1 4 1 5. This gives 0 1 0 1 1.

The two steps put can be together as (1 ↓ 3 1 4 1 5 9) > (¯1 ↓ 3 1 4 1 5 9) giving 0 1 0 1 1.

We can see that the goal has been achieved by placing the result beneath the original list:

3 1 4 1 5 9
 0 1 0 1 1

A 1 in the result indicates that the right item in that pairs of items is greater than the left item.


Write an expression that uses , =, brackets, and + with / to count the number of times that a letter appears immediately after an identical letter in 'bookkeeper'. The result should be 3 ('oo', 'kk', and 'ee').

Answer:Answer:

Note: In this problem, you’re asked to enter your own APL function, without giving it any arguments. Your function will be checked by the APL Challenge system using several tests to see whether it is correct.


7: Double Visions

You can create your own function by putting an expression in curly brackets. For example, the expression 2+3 becomes the function {2+3}. You can let the function take an argument by using (omega, the right-most letter of the Greek alphabet) in the expression; any is replaced by the argument to the right of the closing curly bracket ( } ).

For example, a function that multiplies its argument by two could be written {2×⍵}. Then:

  • {2×⍵} 5 gives 10
  • {2×⍵} 7 gives 14

Using what you learnt in problem 6, write a function that takes a word and counts the number of times that a letter appears immediately after an identical letter. When we write APL code and its result together, we often write the code above the result, with six spaces to the left of the code, so for example:

      {solution} 'bookkeeper'
3

      {solution} 'DYALOG'
0

      {solution} 'Abracadabra'
0

      {solution} 'Cryptooology'
2
Answer:Answer:

In this problem, you’re asked to enter your own APL function, without giving it any arguments. Your function will be checked by the APL Challenge system using several tests to see whether it is correct.


8: Unique Characters

The Unique Mask function takes a list as its right argument and gives a 1 the first time an item appears, 0 for subsequent times. For example, ≠ 3 1 4 1 5 gives 1 1 1 0 1 because:

  • 1 because 3 is the first 3
  • 1 because 1 is the first 1
  • 1 because 4 is the first 4
  • 0 because 1 is the second 1
  • 1 because 5 is the first 5

In contrast, ≠ 'DYALOG' gives 1 1 1 1 1 1, because every letter only appears once.

The And function (looks a bit like the letter A for And) gives 1 if both left and right arguments are 1, but 0 if either is 0. For example, 1 1 0 0 ∧ 0 1 0 1 gives 0 1 0 0.


Use and combined with / (see problem 6) to write a function that takes a list as its argument and gives 1 if the elements are all unique, 0 otherwise. For example:

      {solution} 'DYALOG APL'
0

      {solution} 1 2 3 4 5 6
1

      {solution} 3 1 4 1 5 9 2 6
0

      {solution} 'copyright'
1
Answer:Answer:

Note: In this problem, you’re asked to enter your own APL function, without giving it any arguments. Your function will be checked by the APL Challenge system using several tests to see whether it is correct.


9: Table Motions

If you put ∘. (jot dot, but sometimes called table) immediately to left of a function, then it produces a table for that function. It does this by inserting the function into each combination that can be made with a number from the left list and a number from the right. If the resulting table had row and column headings, the left argument would be used as the headings for the rows (down the left side) and the right argument would be used as the headings for the columns (across the top).

For example, here’s a multiplication table as you might see it in a book:

×2345
246810
3691215
48121620

And here is the same table in APL form:

      2 3 4 ∘.× 2 3 4 5
4  6  8 10
6  9 12 15
8 12 16 20

In problem 7, you saw how to write a function that takes a right argument using . If you want to create a function that also takes a left argument, you can use (alpha; the left-most letter of the Greek alphabet). For example, a function that sums its left and right arguments and then multiplies by 2 could be written {2×⍺+⍵}.


Write a function that takes lists as arguments and uses ∘. to create an addition table. For example:

      10 20 30 {solution} 4 5 6 7
14 15 16 17
24 25 26 27
34 35 36 37

      3 2 7 2 {solution} 9 9 2 5 9 4
12 12 5  8 12  7
11 11 4  7 11  6
16 16 9 12 16 11
11 11 4  7 11  6

      0 1 0 {solution} 0 1 0 0
0 1 0 0
1 2 1 1
0 1 0 0
Answer:Answer:

In this problem, you’re asked to enter your own APL function, without giving it any arguments. Your function will be checked by the APL Challenge system using several tests to see whether it is correct.


10: X Marks the Spot

The Reverse function reverses a list (the symbol looks like a reflection in a mirror). For example, ⌽ 1 2 3 gives 3 2 1.

Remember the And function from problem 8? The Or function (upside-down And) gives 1 if its left or right argument is 1 (or both are 1), but 0 if both are 0. For example, 1 1 0 0 ∨ 0 1 0 1 gives 1 1 0 1.


Use everything that you’ve learnt so far to write a function that takes a positive integer as its only argument and gives a table with that many rows and columns. The table should have 1s on its diagonals and all other items should be 0. For example:

      {solution} 5
1 0 0 0 1
0 1 0 1 0
0 0 1 0 0
0 1 0 1 0
1 0 0 0 1

      {solution} 4
1 0 0 1
0 1 1 0
0 1 1 0
1 0 0 1

      {solution} 1
1
Answer:Answer:

Your Answers

You must be logged in to view submitted solutions!