K46

Logger Rate Limiter

Junior Level Candidate
Target Time: 15 - 20 Minutes
Type: ARRAY

Problem Statement & Objective

Design a logger system that receives a stream of messages along with their timestamps. Each unique message should only be printed at most once every 10 seconds.

Function Signature (Python)

logger_rate_limiter(records: list) -> list[bool]

Input & Output Contract

Output Rule:Her log için boolean değer içeren liste.

System Constraints

1 <= kayitlar.length <= 10^4
0 <= zaman_damgasi <= 10^8
Mesajlar küçük/büyük harf ve rakamlardan oluşur

Example Execution Walkthrough

kayitlar = [[1, 'foo'], [2, 'bar'], [3, 'foo'], [11, 'foo']]
1: 'foo' ilk kez -> True
2: 'bar' ilk kez -> True
3: 'foo' (3 < 1+10) -> False
11: 'foo' (11 >= 1+10) -> True
Cevap: [True, True, False, True]

Example Test Scenarios (3)

Example 1: Basic Flow
Input:[[[1,"foo"],[2,"bar"],[3,"foo"],[11,"foo"]]]
Expected Output:[true,true,false,true]
Example 2: Sınır Değeri 10 ve 11
Input:[[[1,"error"],[10,"error"],[11,"error"]]]
Expected Output:[true,false,true]
Example 3: Farklı Mesajlar
Input:[[[5,"ping"],[6,"pong"],[7,"ping"]]]
Expected Output:[true,true,false]
Loading Python Editor...
Input Parameters
[
  [
    [
      1,
      "foo"
    ],
    [
      2,
      "bar"
    ],
    [
      3,
      "foo"
    ],
    [
      11,
      "foo"
    ]
  ]
]
Expected Output
[
  true,
  true,
  false,
  true
]