7 kyu

Mythical Heads and Tails

448 of 984SavageWilliam

Description:

You're in ancient Greece and giving Philoctetes a hand in preparing a training exercise for Hercules! You've filled a pit with two different ferocious mythical creatures for Hercules to battle!

The formidable "Orthus" is a 2 headed dog with 1 tail. The mighty "Hydra" has 5 heads and 1 tail.

Before Hercules goes in, he asks you "How many of each beast am I up against!?".

You know the total number of heads and the total number of tails, that's the dangerous parts, right? But you didn't consider how many of each beast.

Task

Given the number of heads and the number of tails, work out the number of each mythical beast!

The data is given as two parameters. Your answer should be returned as an array:

 VALID ->      [24 , 15]           INVALID ->  "No solutions"
            [Orthus, Hydra]
 VALID ->      [24 , 15]           INVALID ->  "No solutions"
 VALID ->      [24 , 15]           INVALID ->  null

If there aren't any cases for the given amount of heads and tails - return "No solutions" or null (C#).

Mathematics
Fundamentals

Stats:

CreatedJun 3, 2016
PublishedJun 3, 2016
Warriors Trained2139
Total Skips48
Total Code Submissions5089
Total Times Completed984
JavaScript Completions359
Haskell Completions80
Python Completions448
Ruby Completions53
C# Completions108
Total Stars35
% of votes with a positive feedback rating91% of 232
Total "Very Satisfied" Votes198
Total "Somewhat Satisfied" Votes27
Total "Not Satisfied" Votes7
Ad
Contributors
  • SavageWilliam Avatar
  • bkaes Avatar
  • GiacomoSorbi Avatar
  • raulbc777 Avatar
  • Insti Avatar
  • aryan-firouzian Avatar
  • donaldsebleung Avatar
  • Voile Avatar
  • hobovsky Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad