logo

Logger Rate Limiter:设计一个日志速率限制器,同一条日志在10秒内不重复打印。

Logger Rate Limiter: Design a logger system that receives a stream of messages and returns true if the message should be printed (not printed in the last 10 seconds).

题目类型: 技术面试题

这是一道技术面试题,常见于澳洲IT公司面试中。

难度: easy

标签: google, real-question, cnblogs

目标公司: Google

参考答案摘要

题目来源 cnblogs (博客园) 2025 Google 面经报告。对应 LeetCode 359,Easy。 思路分析 使用 HashMap 存储每条消息的最后打印时间。 解题方法 HashMap shouldPrintMessage(timestamp, message):如果 message 不在 map 中或 timestamp - map[message] >= 10,则打印并更新时...

本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。

← 返回面试题库

Logger Rate Limiter:设计一个日志速率限制器,同一条日志在10秒内不重复打印。

Easyhash-tabledata-structures

想查看完整答案?

登录匠人学院学习中心,获取 STAR 格式回答和详细技术解析

前往学习中心查看答案