Write One Function, or the Whole Program
Practice problems can now be answered by writing a single function, the way most interview sites ask. The full program is still there, and both are graded the same way.

Every problem on AlgoArena used to ask for a complete program. You read the input yourself, worked out the answer, and printed it in the exact format the statement described. We still think that teaches something, and we once wrote a whole page arguing for it. Most interview sites give you a function with its name and parameters already written, though, so someone preparing for an interview should be able to practice that way. For a beginner, turning a line of text into a list of numbers can also take more effort than the loop the problem is about.
Since September 30, practice problems can be answered either way. If you have never chosen a mode, a problem opens in Function mode.
Two ways to answer
The switch sits next to the language picker above the editor and has two choices, Function and Full program. In Function, you get a single function with its parameters already named and write only its body. The statement changes to match. Its Input and Output sections describe the arguments your function receives and the value it should return. Each example shows arguments and a return value, such as s = "iiq" with true under it, where the full program version shows the raw input and output lines. A problem about a binary tree hands your function the root node, and the starter code shows how a node is defined.
Switch to Full program and you get the original statement back, along with starter code that shows how to read the input. Each mode keeps its own draft, so going back and forth never loses code. The Starter code setting on the Settings page decides which mode practice problems and battles open in.

A few problems are interactive, meaning your code asks a hidden judge questions and works from its answers. Those can only be solved as a function, in 13 of the 17 languages, so their Full program choice is greyed out. Elsewhere, Function mode works in all 17 languages the editor offers.
Graded the same way
A test is plain text: the input a program would read and the output it should print. Function mode grades your code on those same tests. When you run or submit, the server joins a hidden piece of code, called a driver, to yours. The driver reads each test's input, calls your function with it, and prints what the function returns in the format the original problem expects. The problem's usual checker, the code that decides whether an output is right, then grades it the same way it grades a full program. Some problems store their tests in a form a function cannot read as written, so their function versions carry a copy of the tests adjusted to fit.
Anything your code prints along the way is kept apart from the answer and never graded. The test panel shows it under Printed, below what the function returned. You can leave debugging prints in place while you work, where in a full program they would turn a correct answer into a wrong one.

How each function version was made
Every problem needed its own description of how the input text turns into arguments and how a return value turns back into the expected output, which AI drafted and code then checked. Our Expert Solutions for the problem, the reference solutions we publish for it, were rewritten as functions and run on every stored test through the driver, and a function version was kept only when they passed. A second review then read each rewritten statement. Each language's driver also had to pass a shared set of small test inputs covering each kind of input the drivers handle, such as lists, grids, and trees, on the same runner that grades submissions.
In Function mode, Expert Solutions show the function version of each solution, the same code that had to pass the tests.
The examples in Function mode are the statement's own examples, in the order the statement gives them, so a note in the statement that refers to the fourth example still points at the right one. A problem whose statement has no Examples block takes its examples only from the tests the problem marks as public.
Why the full program stays
Programming contests and some interviews still expect a program that reads its own input and prints its answer. Reading input carefully and printing exactly what was asked are skills worth practicing on their own. Our page explaining input based problems now describes both modes and what the full program teaches.
