‹ back to the board

Sunday, October 4

Novicesyntax & basics

The Griffon Flight to Skarrow Isle

The Aerie Mistress of Kestrel Scar has posted a commission: a company of adventurers must be flown across the Gloaming Sound to Skarrow Isle before the autumn gales close the sky. Every griffon in the aerie wears the same saddle, and each saddle holds a fixed number of riders. All the riders fly in a single crossing, so every rider needs a seat on some griffon.

Write griffonsNeeded(riders, seats), which returns the smallest number of griffons needed to carry every rider.

  • riders is a whole number, 0 or greater: how many adventurers must cross.
  • seats is a whole number, 1 or greater: the most riders a single griffon can carry.

Return a whole number. A griffon may fly with fewer riders than it has seats. If there are no riders, no griffons are needed.

  • numeric conversion and rounding
  • Novice

examples

  1. case 1riders of 7, seats of 24 (three full griffons, and a fourth carrying the last rider alone)
  2. case 2riders of 8, seats of 24 (every griffon full, none to spare)
  3. case 3riders of 0, seats of 30
reward
140 XP
signature
griffonsNeeded
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…
  • leftover rider needs another griffon
  • exact fill needs no extra
  • no riders means no griffons
  • single rider on a large saddle
  • riders exactly match one saddle
  • single-seat saddles
  • large company
  • one short of a full flight
The Griffon Flight to Skarrow Isle · bitwick