‹ back to the board

today · Thursday, November 12

Novicesyntax & basics

The Rope-Span of Thessen Gorge

The Rope-Span over Thessen Gorge is old hemp and older planks. The Wardens of the Span will let a pack-mule cross only if the crate on its back weighs no more than the span's posted limit. The Pellwick Mule-Train has halted at the near edge, and its drover needs to know which mules must be unloaded before the crossing.

Write overloadedMules(loads, limit).

  • loads is a list of non-negative integers. Each entry is the weight carried by one mule, in the order the mules stand in the train. The first mule is at position 0.
  • limit is a non-negative integer, the heaviest load a single mule may carry across.

Return a list of the zero-based positions of every mule whose load is strictly greater than limit, in increasing order. A mule whose load is exactly equal to limit may cross and is not listed. If no mule is over the limit, including when loads is empty, return an empty list.

  • list and array basics
  • Novice

examples

  1. case 1loads of [12, 30, 25, 31, 8], limit of 25[1, 3]. The mule at position 2 carries exactly 25, so it may cross.
  2. case 2loads of [10, 10, 10], limit of 10[]. Every load equals the limit, so every mule may cross.
  3. case 3loads of [] (no mules), limit of 10[]
reward
130 XP
signature
overloadedMules
not yet run

TypeScript, run as ES2022 — types are stripped, not checked. If a JS engine would run it, so will we.

loading the editor…
  • mixed train with one load exactly at the limit
  • empty train
  • all loads equal the limit
  • zero limit flags every loaded mule
  • single mule just over
  • empty crates and repeated heavy loads
  • zero limit with empty crates
The Rope-Span of Thessen Gorge · bitwick