educative.io

Educative

Example 2: answer should be option c

In this question “Suppose the time limit for the following timestamps is 5. What will be the correct output sequence?”
, answer should be option C.It is showing Option A.
Correct Answer:
TRUE
TRUE
TRUE
FALSE
TRUE
FALSE

1 Like

Hello @Firoz_Ahmad,

Thank you for reaching out and sharing your thoughts regarding the answer to the question. Let’s carefully review the provided timestamps and the expected behavior of the system:

  1. [2, "okayy"] - TRUE. This is the first occurrence of “okayy”.
  2. [8, "good"] - TRUE. This is the first occurrence of “good”.
  3. [15, "okayy"] - TRUE. More than 5 seconds have passed since “okayy” was last logged (at 2).
  4. [16, "okayy"] - FALSE. Only 1 second has passed since “okayy” was last logged (at 15).
  5. [17, "good"] - TRUE. More than 5 seconds have passed since “good” was last logged (at 8).
  6. [20, "okayy"] - TRUE. Exactly 5 seconds have passed since “okayy” was last logged (at 15).

Based on this analysis, the correct sequence of responses should be option A. This is because we also accept message requests that appear exactly at S seconds. In this example, S was 5, so the last message request was entertained as TRUE.

I hope this provides a bit more clarity as to why option A is correct rather than option C. Feel free to share further feedback and suggestions. Thanks!

Happy learning!