-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Classic 13 Coins Problem #33473
Labels
new-challenge
Propose a new challenge, a PR will be auto generated
Comments
#33474 - Pull Request updated. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Info
Basic info of your challenge questions,
Question
You are given 13 coins. All of them weigh the same except for one, which is either heavier or lighter.
You also have a balance scale that allows you to compare the weights of coins on its two sides.
Your task is to determine which coin is the one with a different weight and whether it is heavier or lighter using no more than 3 weighings.
You will use the
Weigh1
,Weigh2
, andWeigh3
constants to represent each weighing step. Each constant contains the setup for the respective weighing step based on the outcome of the previous weighing.Additionally, the
WeighingOutcome
type will represent the result of each weighing, indicating which side is heavier or if both sides are equal.The test cases will call
Weigh1
,Weigh2
, andWeigh3
to simulate the weighing steps and verify the solution.The
printFakeCoin
function demonstrates how to use these constants in real JS runtime, performing real-time type validation on function parameters based on complex logic.For more insight into balance puzzles, you can refer to this Wikipedia article.
Template
This is the template for challengers to start the coding. Basically, you just need to change the name of your generic/function and leave to implementation
any
.Test Cases
Provide some test cases for your challenge, you can use some utils from
@type-challenges/utils
for asserting.The text was updated successfully, but these errors were encountered: