C++ Backend Tasks

Practical interview rounds often give you a written spec and an empty file. C++ Backend Tasks let you practise that in C++.

You build each function from the spec and run it against visible and hidden tests. The last function in each engine, the summit function, combines your other functions into one result.

Test results for CricketKingsRunning
  • 01

    Single pending bid correctly identified as highest

    pass
  • 02

    Roster count accurate after purchase and release

    pass
  • 03

    Pending bids deducted from available budget

    fail
  • 04

    Duplicate bids for same player detected

    fail
  • 05

    Full pipeline integrated across all functions

    fail
2 of 5 passing
Expected available_budget "75000" but got "100000", pending bids not deducted

The CricketKings sample task

CricketKings is the auction engine of a fantasy cricket platform. It validates bids, counts rosters, tracks budgets and checks eligibility. You build every function from scratch and combine them in a pipeline function.

C++CRICKETKINGS.001
~60m
Brief

Build the auction validation engine

Five separate functions and one pipeline function that combines them. Every function has to handle malformed data, missing fields and inconsistent timestamps. The pipeline combines their outputs into one result.

Functions
  • highest_bid_correctly_identified
  • active_roster_count_accurate
  • budget_reflects_pending_bids
  • duplicate_bids_detected
  • full_pipeline_integrated
What you'll practise
  • Building functions from a written spec
  • Parsing and validating string data you cannot trust
  • Replaying events in time order with sets
  • Combining separate functions in a pipeline function
  • Defensive C++ without exceptions
solution.cppUnsaved
01// Find the highest bid for a player across all teams.
02// Only BID transactions with PENDING or COMPLETED status count.
03// Malformed amounts are treated as 0 but still count as bids.
04// Returns the highest amount as a string, or "NONE" if no bids exist.
05
06void get_highest_bid() {
07 // Implement this function
08}

What a C++ backend round asks of you

Each task is a set of engines. You read the spec for an engine and write each function in C++ from the spec, then run it against the tests.

  1. 01The later rounds of a technical interview often give you a written brief to build against.
  2. 02You build each function in C++ from its brief and validate string data you cannot trust.
  3. 03At Levels 2 and 3 each test shows only its symptom line, so you trace the fault from the symptom.
A C++ Backend Task, an LRU cache is written in C++ from the spec and run against its tests

How a C++ Backend Task is checked and scored

Each task opens on a page that describes it and lists its category, difficulty, time limit, average time per function and language. You choose a mode there and start.

Rules for your C++ code

The test harness calls your functions directly and reads its results from standard output. You do not add a main() function and you do not print with cout, printf or similar calls.

If your code contains main( or an output call, the run stops and a notice explains why before anything is tested.

What a failing test shows

At Level 1 the terminal view shows the input, expected output, actual output, standard error and exit code for each visible test. You can switch to Engineer Mode, which shows a one-line result or symptom for every test.

At Levels 2 and 3 each test shows only its symptom line, so you trace the fault from the symptom.

The summit function

In an engine with two or more functions, the last one is the summit. It opens when every earlier function in the engine passes.

Timers and progress

Each function has its own timer. When it runs out you can keep working, because your score is based on the tests you pass, and the function is marked Timed Out on your results.

The first time a function passes every test, your progress saves. When every function passes, the task is complete and the results page opens.

Your results

The results page shows the share of functions that passed every test, the functions passed, the time taken and the number of code resets. In Challenger mode it also shows tab changes and full-screen exits.

Progress by engine lists every function with its tests passed, its time and its mode, and marks any function that timed out or was not started.

Training mode and Challenger mode

Before each task starts you choose a mode. Challenger mode simulates the conditions of a real online assessment. Training mode lets you practise the same task without restrictions.

In Challenger mode, full screen turns on when you start and each function has a countdown timer. Leaving full screen or switching tabs is recorded on your results. Copying code out of the editor is blocked, and each function opens only after the one before it passes.

In Training mode there is no time pressure. The timer counts up, you can switch tabs, full screen is not required, copy and paste work, and every function is open.

Training Ground, choosing between Challenger mode and Training mode before a task starts

Three levels in every set

Each set of C++ Backend Tasks has three levels, and each level adds conditions the code has to handle.

L1

Level 1, structures from a spec

You read the spec and build the structure and its logic in C++. Each function has to return exactly what the spec describes.

L2

Level 2, performance under load

Each design decision has a cost that the tests measure. A structure that works on small inputs but is slow on large ones fails the larger tests.

L3

Level 3, design decisions

Tasks test whether your design holds up under load and scales as the input grows, as well as whether it returns the right result.

What each C++ Backend Task includes

01

Built from the spec

Each function has a brief that says what it must do and an approach tab that describes how to tackle it. You write the implementation.

02

Visible and hidden tests

The Tests tab shows the visible tests with their input and expected output. Run Code runs every test, hidden tests included, and the hidden tests count toward your passed total.

03

A summit function

The last function in an engine combines your other functions. It opens when every earlier function in the engine passes.

04

Backend systems as the setting

Tasks are set in backend systems such as fantasy cricket, auction platforms and tournament infrastructure.