wes d2a2ba9e15 first commit 4 years ago
..
README.md d2a2ba9e15 first commit 4 years ago
code.cpp d2a2ba9e15 first commit 4 years ago
unitTest.cpp d2a2ba9e15 first commit 4 years ago

README.md

The Centrifuge Problem

by Matt tags: algorithms, math, numbers, validation

Summary

A centrifuge, as you probably know, is a laboratory device used to separate fluids based on density. The separation is achieved through centripetal force by spinning a collection of test tubes at high speeds. This means, the configuration needs to be in balance. Create a function that takes two numbers as arguments n and k and returns true if the configuratio

Instructions

A centrifuge, as you probably know, is a laboratory device used to separate fluids based on density. The separation is achieved through centripetal force by spinning a collection of test tubes at high speeds. This means, the configuration needs to be in balance.

Create a function that takes two numbers as arguments n and k and returns true if the configuration is balanced and false if it's not. To check out the formula, look at the resources tab.

Here are the valid configurations for n = 6, k = 2, 3, 4 and 6.

Examples

cFuge(6, 4) ➞ true

cFuge(2, 1) ➞ false

cFuge(3, 3) ➞ true

Notes

  • One test tube (k = 1) is never in balance.
  • One hole (n = 1) is never in balance, even empty.