Challenge Nov-2017

Soldier Payment Rules                                                                      Solutions

During different service periods a soldier may have the following characteristics:SoldierPayments

  1. Rank {private, corporal, sergeant, lieutenant, captain}
  2. Profession {fighter, driver, cook, officer}
  3. Service Type {active, reserve, retired}
  4. Unit {HQ, paratroopers, marines, infantry}
  5. Combat {yes, no}

Ranks must not overlap, while other characteristics may overlap during the same time periods.

Pay rate is determined by aggregating the amounts according to these rules:

  1. Base rate is $1/hr.
  2. Private $1/hr., corporal $2/hr., sergeant $3/hr., lieutenant $4/hr., captain $5/hr.
  3. Fighter $2/hr., driver $1/hr., cook $1/hr., officer $3/hr.
  4. Active $2/hr., Reserve $1/hr.
  5. HQ $1/hr., others $2/hr.
  6. Combat $5/hr., non-combat $0/hr.


  1. Rank: Private 1/1/2015-12/31/2015,
  2. Profession: Fighter 1/1/2015-6/30/2015, Cook 7/1/2015-12/1/2015
  3. Service Type: Active 1/1/2015-6/30/2015, Reserve 7/1/2015-12/1/2015
  4. Unit: HQ 1/1/2015-12/31/2015
  5. Combat: 4/1/2015-6/30/2015

On 6/1/2015 he was a private, a fighter, on active duty, at HQ, in combat, So, his pay rate was 1+1+2+2+1+5 = $12/hr

The challenge: assemble a single timeline for the soldier over a given service period that shows his/her hourly pay rate in any given time. Flag any conflicting dates (e.g. can’t be a sergeant and a lieutenant at the same time).

Additional challenge: What are all the different aggregated pay rates that apply and during which periods?

Send your solutions to


This challenge was proposed by Michael Parish.