We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Coin on the Table
Coin on the Table
Sort by
recency
|
51 Discussions
|
Please Login in order to post a comment
You should use stone center table for the coin toss purpose as it is more reliable and best metrial in it.
Coin on the Table" is a mathematical game often presented as a puzzle. The game involves a grid or table filled with coins, and the objective is to determine the minimum number of moves required to rearrange the coins to satisfy a certain condition for Lost ark eng cal. The condition typically involves moving a coin from one cell to another with the goal of reaching a desired arrangement.
The specific rules and conditions of the "Coin on the Table" puzzle can vary, but here's a general description of how the game is often played:
Game Setup:
The game is played on a grid or table. Each cell of the grid contains a coin, and the coins can be facing heads or tails. One cell is usually marked as the starting position, and another cell is designated as the target or goal position.
Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Coin on the Table Problem Solution
Another approach is to find the minimum number of steps required to reach all reachable cells using a certain number of operations.
Let dp[i, j, c] = minimum number of steps to reach cell (i, j) using c operations.
This can be done using BFS, starting at (i, j) = (0, 0) with c = 0. Explore every reachable node from (0, 0) while using 0 operation. While exploring you will also find cells that require c + 1 (= 1 in this iteration). Put those aside in a separate queue. Then re-do this process for all the nodes in that seperate queue.
The only trick here is that the dp array is partially kept up to date. For example, dp[0, 0, 0] = 0, but dp[0, 0, >0] = inf. This doesn't affect anything because dp[, , c] will only ever be compared with dp[, , c + { -1, 0, 1 }]. It will never incorrectly interpret a hole left by the partial update as a potential better solution, because it won't look at such holes.
Here is Coin on the Table problem solution - https://programs.programmingoneonone.com/2021/07/hackerrank-coin-on-the-table-problem-solution.html