Posts

Showing posts with the label recursion

Minefield Challenge [on hold]

Minefield Challenge [on hold] Got interesting code challenge recently (below), thought about it for awhile, but could not really come up with solution. Would really appreciate help!! Notice that it's not 2D matrix and traditional minesweeper challenge. Thoughts coming to mind - sub-graph, recursive algorithms, but seems I am over-thinking the problem.. (say I have 10,000 mines - I have to iterate thru all 10K, and then collect winning mines for a 2nd level of explosions etc.) Explosive power is basically to calculate a distance to the near-by mine (if reachable) Challenge Write a program which takes as input a list of mines composing a 2D minefield; each mine has an X position, a Y position, and an explosive power. All three parameters may be assumed to be single-precision floats; explosive power may not be negative. There may not be more than one mine at the same coordinates. When a mine in the minefield is triggered at time T=0, it causes all other mines within a straight-line di...