
-----------------------------------
Panphobia
Wed Nov 28, 2012 7:57 pm

Round 2 questions
-----------------------------------
Could someone please explain what algorithms we needed to use for question 4 and 5 on the dwite contest, that would be nice, I know the rest of it, but my team had trouble with the last two, we knew the logic, just not exactly how to implement it.

-----------------------------------
Tony
Wed Nov 28, 2012 10:40 pm

RE:Round 2 questions
-----------------------------------
Question 4 is about maintaining a list of cards that have not yet been used in the answer deck. The note after the sample explains most of it:

Notes: for the first case, going backwards from the solution: the first card has value 2, and there is only 1 card with greater value after it (3). Second card has value 1, and there is only 1 card with greater value after it (3). The last card has value of 3, and there are no cards with greater value. So the input of "1 1 0" checks out.


Going the other way:
possible cards (sorted order): must monitor the first car, so place the first guard as far away as possible, while he can still monitor this car. Remove all of the cars that he can observe from the list. Repeat until the list is empty.

-----------------------------------
Panphobia
Wed Nov 28, 2012 11:14 pm

RE:Round 2 questions
-----------------------------------
ohhhhh if only i read it right tony you're a lifesaver :)

-----------------------------------
Panphobia
Wed Nov 28, 2012 11:22 pm

RE:Round 2 questions
-----------------------------------
haha now I have to find out how to use a greedy algorithm, funn :DDDDDDD, I was expecting a grid/maze type question, because that is all i practiced, here comes dwite, NO GRID/MAZE type question lol
