wes d2a2ba9e15 first commit | 4 years ago | |
---|---|---|
.. | ||
README.md | 4 years ago | |
code.cpp | 4 years ago | |
unitTest.cpp | 4 years ago |
by Matt tags: algorithms, math, numbers, validation
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
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.
cFuge(6, 4) ➞ true
cFuge(2, 1) ➞ false
cFuge(3, 3) ➞ true