Puzzle \| Bag of Coins Puzzle: Ishita has 10 bags full of coins. Each bag contains 1000 coins. But one bag is full of forgeries, and she just can t recall which one. She does know that genuine coins weigh 1 gram, but forgeries weigh 1.1 grams. To hide the fact that she can t recall which bag contains forgeries, she needs your help. How can she identify the bag with the forgeries with just one weighing? Solution: It is known that there is only one bag with forgeries. To identify that bag, Ishita can follow a simple procedure. She should take out 1 coin from the 1st bag, 2 coins from the 2nd bag, 3 coins from the 3rd bag and similarly 10 coins from the 10th bag. Now she should simply weigh all these picked coins together. If there were no forgeries, then the total weight should be \(1+2+3+ . . . +10\) = 55 grams. Now, if the total weight comes out to be 55.3 then she can conclude that the 3rd bag contain forgeries. So, if the total weight is \(55.n\), then it is clear that the nth bag contain forgeries. Youtube video: https://lnkd.in/dknMEiYF \#nikolays_genetics_lessons
Nikolay's Genetics Lessons的动态
最相关的动态
-
Puzzle \| Bag of Coins Puzzle: Ishita has 10 bags full of coins. Each bag contains 1000 coins. But one bag is full of forgeries, and she just can t recall which one. She does know that genuine coins weigh 1 gram, but forgeries weigh 1.1 grams. To hide the fact that she can t recall which bag contains forgeries, she needs your help. How can she identify the bag with the forgeries with just one weighing? Solution: It is known that there is only one bag with forgeries. To identify that bag, Ishita can follow a simple procedure. She should take out 1 coin from the 1st bag, 2 coins from the 2nd bag, 3 coins from the 3rd bag and similarly 10 coins from the 10th bag. Now she should simply weigh all these picked coins together. If there were no forgeries, then the total weight should be \(1+2+3+ . . . +10\) = 55 grams. Now, if the total weight comes out to be 55.3 then she can conclude that the 3rd bag contain forgeries. So, if the total weight is \(55.n\), then it is clear that the nth bag contain forgeries. Youtube video: https://lnkd.in/dUrCCY7v \#nikolays_genetics_lessons
Puzzle | Bag of Coins
https://www.youtube.com/
要查看或添加评论,请登录
-
Hello everyone #37 - ???????????????? ???????????????? 151 ?????????????????? ??-?? - Mohd Fahad Feel free to ask if there are any queries and do share your ideas too. ??. ?????????????????????????? ? https://lnkd.in/gwPjn5vC? ?????????? ?????????? ??(1)? return max(a1,a2)+max(a3,a4)+max(a5,a6) ???????? ???????? ? https://lnkd.in/gtwDUSk3 ??. ?????????????????????????? ?????? ?????? ? https://lnkd.in/gbwRV9Uy? ???????????? ??(N) keep on using 0 coins up to N coins if it is possible to buy then print ans and return at that step else -1. ???????? ???????? ? https://lnkd.in/gwWMT5v8 ??. ?????????????? ???????????? ? https://lnkd.in/g8YMaCC9? ???????????? ??(??) First Observe that you can switch all 1 to 0 and all 0 to 1 to have our answer. Now let the flip for 1 to 0 be x. Then if i do x+2 flip i can just flip again anyone twice and still get all same. So ans will be x, x+2, x+4, x+2*k, and same for y(the flip form 0 to 1) be y, y+2, y+4, y+2*u. To keep on what value can be used i implemented using a map. Then just give the count of value whose map is non zero. ???????? ???????? ? https://lnkd.in/gy8G4t_6 ??. ???????? ???????? ? https://lnkd.in/gpTtUMqg? ???????????????????????????? ??(??) Two balls will intersect when a1/b1>a2/b2. Hence i used a stack to keep count of how many balls are left in stack finally. If the current top ball in stack reaches after our current ball in interation then pop otherwise just push the current ball in stack. Here we can see that stack will have balls that do not intersect at all times. ???????? ???????? ? https://lnkd.in/g8xeJ3qa ??. ???????????????? ???????????? ? https://lnkd.in/gWdfBzjb? ?????????????? ??(1)? Just see that X1=0, X2=A, X3=B, X4=A+B, X5=2B, X6=2B+A….. We can just say that if i is even then Xi=((i/2)-1)*B+A, if odd then Xi=(i/2)*B. Now this looks much better to see that if A=n*B+rem; then sorted X will be 0, B, 2B, 3B……….(n-1)B, nB, nB+rem, (n+1)B. (n+1)B+rem….. And so on. print the kth element of this pattern. ???????? ???????? ? https://lnkd.in/ghGE-8m8 ??. ???????????????? (????????) ? https://lnkd.in/gD9fu572? ???????????? / ???????????????????????????? ??(??)? first i will do for player1, Now for any point i will find the prefix score and suffix score. In the end just give abs( (pref+suff of player1) - (pref+suff of player2)).? ???????? ???????? ? https://lnkd.in/gZ4Ear-X ??. ???????????????? (????????) ? https://lnkd.in/gWyun2HN ???????????? / ???????????????????????????? ??(??*??)? first i will do for player1, I will have 4 prefix kinda matrix like if i need to find anser for (i,j), It will give answer (0,0) to (i,j) and (0,m-1) to (i,j) and (n-1,0) to (i,j) and (n-1,m-1) to (i,j) then we remove the extra using suffix prefix as used in Shooting easy. ???????? ???????? ? ???????? ???????????? ???????? ?????????? ??????????????????. Context-https://lnkd.in/g_puUr4t Thank you.
要查看或添加评论,请登录
-
-
#SmPriceBend-T01 - indicator MetaTrader 5 https://lnkd.in/ea5JWhdV # The real author: HomeSoft-Tartan Corp. The indicator of the first price change derivative or simply trend speed and sign. Color indication has four states. Light colors correspond to strong trends, dark - to weak trends and a flat. For longs correspond blue shades...
要查看或添加评论,请登录
-
?? ?????? ?????? - ?????? ???????? ???? ?????????????? ?????????????? ?? Day 77/160: 30th January ?????????????? : N-Queen Problem ?????????????? ????????: https://lnkd.in/g3WthQ_b ?????????????? ??????????????????: The?n-queens puzzle is the problem of placing n queens on a?(n × n)?chessboard such that no two queens can attack each other. Note that two queens attack each other if they are placed on the same row, the same column, or the same diagonal. Given an integer?n, find all distinct solutions to the?n-queens puzzle. You can return your answer in?any?order but each solution should represent a distinct board configuration of the queen placements, where the solutions are represented as permutations of [1, 2, 3, ..., n]. In this representation, the number in the?ith?position denotes the row in which the queen is placed in the?ith?column. For eg. below figure represents a chessboard?[3 1 4 2]. Examples: Input: n = 1 Output: [1] Explaination: Only one queen can be placed in the single cell available. Input: n = 4 Output: [[2 4 1 3 ] [3 1 4 2 ]] Explaination: There are 2 possible solutions for n = 4. Input: n = 2 Output: [] Explaination: There are no possible solutions for n = 2. Constraints: 1 ≤ n ≤ 10 ???????????????????????????? ??????????: ? Input Parameters and State Tracking list: A 2D list (ArrayList<ArrayList<Integer>>) that stores all valid solutions, where each solution is represented as a list of integers indicating column positions for queens in each row. board: A 2D array (int[][]) used to track queen placements on the chessboard. ? Base Case When col >= N (all queens are placed successfully), invoke printSolution to store the current configuration in list. ? Safety Check for Queen Placement (isSafe): This function ensures that a queen can be safely placed at (row, col) by checking: Row on the left: No other queens should be present in the same row to the left of the column. Upper-left diagonal: Lower-left diagonal: No queens should exist diagonally in the lower-left direction. ? Recursive Backtracking (solveNQueen): Try placing a queen in each row of the current column col. For each valid placement (isSafe returns true): Place the queen (board[row][col] = 1). Recursively solve for the next column (col + 1). Backtrack by removing the queen (board[row][col] = 0) when the recursion completes. ???????? ????????????????????: O(N!) Each column tries placing a queen in one of the N rows. For each placement, recursive calls explore the remaining columns. This results in a factorial growth in possibilities. ?????????? ????????????????????: O(N2) Recursive stack space is proportional to N calls in the worst case. Additional space is used to store solutions in list. Grateful to GeeksforGeeks for this incredible opportunity to showcase our skills ? and for helping us maintain consistency in our learning journey ????. Let's code together, let's think together ?? #geekstreak2024 #gfg160 #GeeksforGeeks
要查看或添加评论,请登录
-
-
#Histogram Blanket - indicator for MetaTrader 4 https://lnkd.in/eUR-6jUj # On a candlestick chart, you see more open and close market than all effort of the market in the period. This new representation helps to see charts in a new different way. Parameters: extern color???? ColorBull=clrGreen;????????????????????????????//The color for Bull line and hi...
#Histogram Blanket - indicator for MetaTrader 4 https://tradingrobots.net/histogram-blanket-indicator-for-metatrader-4/ # On a candlestick chart, you see more open and close market than all effort of the market in the period. This new representation helps to see charts in a new different way. Parameters: extern color???? ColorBull=clrGreen;???????????????????...
https://tradingrobots.net
要查看或添加评论,请登录