Ad
  • Default User Avatar

    Stack is synchronized, which is not needed here. Use Deque instead.

  • Default User Avatar

    I think there may be some confusion here, but the task says there is ALWAYS one person lying.

    If one of the persons is Mr. Wrong, then by elimination it cannot be Tom (that would entail Bob lying as well), cannot be Bob, nor Gary - by the same logic. Only Fred states something that isn't backed up by the others. So if someone IS lying, it must be Fred; and the tasks says someone IS lying in every example.