第 8 / 10 页
非代码面试题
显示 20 / 182 道匹配题目
答题状态:未尝试未正确已正确
ID题目领域难度题型进度权限
5698Twelve Coins, Unknown DirectionYou have 12 coins that look identical. Exactly one is counterfeit and has a different weight from the rest, but you do NOT know whether it is heavier or lighter. Using only a two-pan balance scale (each weighing reports left-heavy, right-heavy, or balanced), what is the minimum number of weighings that guarantees you both identify the counterfeit AND determine whether it is heavy or light? Weighings may be chosen adaptively.脑筋急转弯中等brainteaser未尝试免费5699Sorting Five With Fewest ComparisonsYou must sort 5 distinct numbers using only pairwise comparisons, each of which returns which of the two compared elements is larger. What is the information-theoretic lower bound on the worst-case number of comparisons any comparison-based sorting algorithm needs, AND is that bound actually achievable for 5 elements? Give the minimum worst-case number of comparisons that guarantees a full sort.脑筋急转弯中等brainteaser未尝试免费5701Guess the Number 1 to 1000An adversary picks a secret integer between 1 and 1000 inclusive. You may ask yes/no questions, each answered truthfully, and you may choose each question adaptively based on previous answers. What is the minimum number of questions that guarantees you can determine the secret number in the worst case?脑筋急转弯简单brainteaser未尝试免费5703Eight Coins, One Known LighterYou have 8 visually identical coins; exactly one is counterfeit and is known to be LIGHTER than the rest. Using a two-pan balance scale (left-heavy / right-heavy / balanced per weighing), what is the minimum number of weighings that guarantees identifying the light coin in the worst case? Weighings may be adaptive.脑筋急转弯简单brainteaser未尝试免费5704Heaviest and Runner-UpYou have 8 coins of pairwise-distinct weights and a balance scale that compares two single coins and tells you which is heavier. What is the minimum number of pairwise weighings, in the worst case, needed to identify BOTH the heaviest coin and the second-heaviest coin? (This is the classic tournament problem.)脑筋急转弯中等brainteaser未尝试免费5705Prisoners and the Lightbulb Counter100 prisoners take turns, one at a time in an arbitrary order chosen by a warden, entering a room with a single lightbulb (initially OFF). Each visiting prisoner may toggle the bulb and observe its state, but cannot otherwise communicate. At any point any prisoner may declare 'every prisoner has now visited at least once'; they win only if the declaration is true. They strategize beforehand. In the standard single-counter strategy, exactly one designated counter increments a tally when he finds the bulb ON (then switches it OFF), and every other prisoner switches the bulb ON the FIRST time they find it OFF (and never again). What total count must the counter reach before he can safely declare everyone has visited?脑筋急转弯困难brainteaser未尝试面试订阅5709Two Light Fakes Among SixYou have 6 visually identical coins. Exactly TWO of them are counterfeit and each counterfeit weighs the same known-lighter amount (both fakes are equally light); the other four are genuine and equal. Using a two-pan balance scale (each weighing returns left-heavy, right-heavy, or balanced), what is the minimum number of weighings that guarantees identifying WHICH two coins are the light pair in the worst case? Weighings may be adaptive.脑筋急转弯困难brainteaser未尝试面试订阅5712Four Glasses on a Spinning TableFour glasses sit at the corners of a square rotating table, each independently up or down (initial configuration unknown). On each move a blindfolded robot may reach into any TWO of the four positions, feel their orientations, and flip either, both, or neither. After each move the table is spun by an adversary to an unknown rotation, so the robot never knows absolute positions, only relative ones (it can choose 'two adjacent' or 'two diagonal'). A bell rings the instant all four glasses match (all up or all down). What is the minimum number of moves that GUARANTEES the bell rings in the worst case?脑筋急转弯困难brainteaser未尝试面试订阅5713Two Eggs, One Hundred FloorsA building has 100 floors. There is a critical floor f such that an egg dropped from floor f or above breaks, and an egg dropped from any floor below f survives (f may be any of 1..100, or eggs never break, treated as f = 101). You have exactly 2 identical eggs; a broken egg cannot be reused, but an egg that survives a drop can be dropped again. What is the minimum number of drops that GUARANTEES determining f in the worst case? (Drops may be chosen adaptively.)脑筋急转弯中等brainteaser未尝试免费5714Twenty Questions With One LieAn adversary picks a secret integer from 1 to 16 inclusive. You ask yes/no questions chosen adaptively, but the adversary is allowed to answer FALSELY at most once during the whole game (it may also never lie). What is the minimum number of questions that GUARANTEES you can determine the secret number in the worst case?脑筋急转弯困难brainteaser未尝试面试订阅5715Bridge and Torch CrossingFour people must cross a rickety bridge at night. They have one torch, and the bridge holds at most two people at a time. Anyone on the bridge must carry the torch, so the torch must be walked back for the next group. The four people walk at different speeds, needing 1, 2, 5, and 10 minutes respectively to cross; when two cross together they move at the slower person's pace. What is the minimum total time for all four to get across?脑筋急转弯中等brainteaser未尝试免费5716Measuring Four Units with a 3-Jug and a 5-JugYou have an unlimited water supply, a 3-unit jug, and a 5-unit jug, both unmarked. The only operations allowed are: fill a jug completely from the supply, empty a jug onto the ground, or pour from one jug into the other until the source is empty or the destination is full. What is the minimum number of such operations needed to end with exactly 4 units of water in a jug?脑筋急转弯简单brainteaser未尝试免费5717Ferrying Guards and PrisonersThree guards and three prisoners must cross a river using a single boat that holds at most two people and cannot cross empty (someone must row it). At no time and on neither bank may prisoners outnumber the guards present there (if guards are present); if no guard is on a bank, any number of prisoners there is fine. Everyone can row. What is the minimum number of one-way boat trips needed to move all six across safely?脑筋急转弯困难brainteaser未尝试面试订阅5719Two Eggs, One Hundred FloorsThere is a 100-floor building and two identical eggs. An egg breaks if dropped from floor h or above for some unknown threshold h (and survives any drop below h); a survived egg can be reused, a broken one cannot. You want to determine h with certainty. Drops are made one at a time and you choose each next floor adaptively. What is the minimum number of drops that guarantees you can identify h in the worst case?脑筋急转弯困难brainteaser未尝试面试订阅5720Sorting Pancakes by Spatula FlipsA stack of four pancakes has diameters, from top to bottom, 3,1,4,2 (all distinct). The only allowed move is to insert a spatula under any pancake and flip the entire block above it, reversing the order of that top prefix. You want the pancakes sorted with the largest on the bottom and the smallest on top (i.e. top-to-bottom 1,2,3,4). What is the minimum number of flips required?脑筋急转弯中等brainteaser未尝试免费5721Shortest Possible Project Completion TimeA project has six tasks with durations (in hours): A=3, B=2, C=4, D=1, E=5, F=2. The precedence constraints are: A must finish before C and D start; B must finish before D starts; C and D must both finish before E starts; D must finish before F starts. Any number of tasks may run in parallel as long as all their prerequisites are complete. Starting at time 0, what is the earliest time at which all six tasks are finished?脑筋急转弯中等brainteaser未尝试免费5723Sequencing Jobs Through Two MachinesThree jobs must each be processed first on Machine 1 and then on Machine 2, in that order. Each machine handles one job at a time, jobs cannot be preempted, and all jobs are available at time 0. Processing times (Machine 1, Machine 2) in minutes are: Job X = (3, 2), Job Y = (2, 4), Job Z = (4, 3). You may choose the order in which jobs enter the system (the same order is used on both machines). What is the minimum possible time at which all three jobs are completely finished?脑筋急转弯中等brainteaser未尝试面试订阅5728Tower of Hanoi with Five DisksFive disks of distinct sizes are stacked on the first of three pegs, largest at the bottom and smallest on top. You move disks one at a time from the top of any peg to the top of another peg, and a disk may never be placed on top of a smaller disk. What is the minimum number of single-disk moves needed to transfer the entire stack to the third peg?脑筋急转弯中等brainteaser未尝试免费5730Splitting Eight Units with Three JugsYou have three unmarked jugs with capacities 8, 5, and 3 units. The 8-unit jug starts completely full and the other two are empty; there is no other water source and no drain (water may only be poured between jugs). A pour transfers from one jug to another until the source is empty or the destination is full, and counts as one operation. What is the minimum number of pours needed to end with exactly 4 units in the 8-jug and 4 units in the 5-jug?脑筋急转弯困难brainteaser未尝试面试订阅5731Paying with a Gold ChainA traveler must pay an innkeeper one gold link per day for seven days, using a chain of 7 identical links. The innkeeper insists on holding exactly the right number of links each day, but is willing to give change from links already paid (so the traveler can hand over a larger piece and take back smaller ones). The traveler may cut some links open to break the chain into pieces. What is the minimum number of links that must be cut so that a correct payment can be made every day for all seven days?脑筋急转弯困难brainteaser未尝试面试订阅