content_1729487674688.zip
资源文件列表:

1056-完成任务的最少工作时间段 [minimum-number-of-work-sessions-to-finish-the-tasks].html 2.37KB
1104-将字符串翻转到单调递增 [flip-string-to-monotone-increasing].html 1.2KB
1116-将整数按权重排序 [sort-integers-by-the-power-value].html 2.26KB
1149-布尔运算 [boolean-evaluation-lcci].html 787B
1159-平衡括号字符串的最少插入次数 [minimum-insertions-to-balance-a-parentheses-string].html 2.48KB
1188-得到目标值的最少行动次数 [minimum-moves-to-reach-target-score].html 1.72KB
1198-快照数组 [snapshot-array].html 1.84KB
1203-恢复空格 [re-space-lcci].html 1.37KB
1210-我的日程安排表 I [my-calendar-i].html 1.82KB
1211-我的日程安排表 II [my-calendar-ii].html 2.28KB
1213-我能赢吗 [can-i-win].html 1.82KB
1227-所有排列中的最大和 [maximum-sum-obtained-of-any-permutation].html 2.33KB
1240-打家劫舍 II [house-robber-ii].html 1.41KB
1255-找两个和为目标值且不重叠的子数组 [find-two-non-overlapping-sub-arrays-each-with-target-sum].html 1.92KB
1263-找出最具竞争力的子序列 [find-the-most-competitive-subsequence].html 1.39KB
1286-找出输掉零场或一场比赛的玩家 [find-players-with-zero-or-one-losses].html 1.99KB
1288-找到 K 个最接近的元素 [find-k-closest-elements].html 1.13KB
1301-找到所有好下标 [find-all-good-indices].html 1.57KB
1308-找到需要补充粉笔的学生编号 [find-the-student-that-will-replace-the-chalk].html 2.59KB
1312-把数字翻译成字符串 [ba-shu-zi-fan-yi-cheng-zi-fu-chuan-lcof].html 771B
1313-把数组排成最小的数 [ba-shu-zu-pai-cheng-zui-xiao-de-shu-lcof].html 812B
1326-拼车 [car-pooling].html 1.48KB
1327-拿出最少数目的魔法豆 [removing-minimum-number-of-magic-beans].html 2.32KB
1332-按位或最大的最小子数组长度 [smallest-subarrays-with-maximum-bitwise-or].html 2.54KB
1344-按权重随机选择 [random-pick-with-weight].html 2.13KB
1349-按递增顺序显示卡牌 [reveal-cards-in-increasing-order].html 1.85KB
1361-排序数组中只出现一次的数字 [skFtm2].html 1.07KB
1368-推文计数 [tweet-counts-per-frequency].html 4.03KB
1378-搜索二维矩阵 [search-a-2d-matrix].html 1.12KB
1379-搜索二维矩阵 II [search-a-2d-matrix-ii].html 1.33KB
1382-搜索旋转排序数组 [search-in-rotated-sorted-array].html 1.71KB
1383-搜索旋转排序数组 II [search-in-rotated-sorted-array-ii].html 2.01KB
1386-摆动序列 [wiggle-subsequence].html 1.93KB
1387-摆动排序 II [wiggle-sort-ii].html 1.01KB
1391-摧毁小行星 [destroying-asteroids].html 1.97KB
1397-收集足够苹果的最小花园周长 [minimum-garden-perimeter-to-collect-enough-apples].html 1.64KB
1398-改变一个整数能得到的最大差值 [max-difference-you-can-get-from-changing-an-integer].html 2.02KB
1400-救生艇 [boats-to-save-people].html 1.22KB
1406-数字流的秩 [rank-from-stream-lcci].html 907B
1411-数对和 [pairs-with-sum-lcci].html 494B
1419-数组中最大数对和的最小值 [minimize-maximum-pair-sum-in-array].html 1.65KB
1421-数组中和为 0 的三个数 [1fGaJU].html 1.1KB
1424-数组中的 k 个最强值 [the-k-strongest-values-in-an-array].html 2.77KB
1458-整数替换 [integer-replacement].html 1.08KB
1475-旋转函数 [rotate-function].html 1.43KB
1486-无重叠区间 [non-overlapping-intervals].html 1.2KB
1531-有效的括号字符串 [valid-parenthesis-string].html 1.16KB
1607-检查数组是否存在有效划分 [check-if-there-is-a-valid-partition-for-the-array].html 1.64KB
1693-火柴拼正方形 [matchsticks-to-square].html 1.18KB
1713-猜数字大小 II [guess-number-higher-or-lower-ii].html 3.81KB
1723-环形房屋偷盗 [PzWKhm].html 1.65KB
1731-球会落何处 [where-will-the-ball-fall].html 2.46KB
1808-硬币 [coin-lcci].html 741B
1865-粉刷房子 [JEj789].html 1.62KB
1900-统计全 1 子矩形 [count-submatrices-with-all-ones].html 1.59KB
2155-连续子数组的最大和 [lian-xu-zi-shu-zu-de-zui-da-he-lcof].html 762B
2158-连续数列 [contiguous-sequence-lcci].html 444B
361-使字符串有序的最少操作次数 [minimum-number-of-operations-to-make-string-sorted].html 2.49KB
419-公平分发饼干 [fair-distribution-of-cookies].html 1.75KB
427-最低票价 [minimum-cost-for-tickets].html 2.72KB
428-最佳买卖股票时机含冷冻期 [best-time-to-buy-and-sell-stock-with-cooldown].html 1.08KB
454-最大加号标志 [largest-plus-sign].html 1.95KB
476-最大的以 1 为边界的正方形 [largest-1-bordered-square].html 829B
488-最大黑方阵 [max-black-square-lcci].html 1.12KB
563-最长回文子串 [longest-palindromic-substring].html 589B
575-最长理想子序列 [longest-ideal-subsequence].html 1.69KB
698-判断子序列 [is-subsequence].html 1.25KB
889-回文子字符串的个数 [a7VOhD].html 1023B
923-地图分析 [as-far-from-land-as-possible].html 1.84KB
957-多米诺和托米诺平铺 [domino-and-tromino-tiling].html 1.21KB
算法设计与分析任务汇报选题单.xlsx 13.4KB
资源介绍:
content_1729487674688.zip一家社交媒体公司正试图通过分析特定时间段内出现的推文数量来监控其网站上的活动。这些时间段可以根据特定的频率( 每分钟 、每小时 或 每一天 )划分为更小的 时间段 。
例如,周期 [10,10000]
(以 秒 为单位)将被划分为以下频率的 时间块 :
- 每 分钟 (60秒 块):
[10,69]
,[70,129]
,[130,189]
,...
,[9970,10000]
- 每 小时 (3600秒 块):
[10,3609]
,[3610,7209]
,[7210,10000]
- 每 天 (86400秒 块):
[10,10000]
注意,最后一个块可能比指定频率的块大小更短,并且总是以时间段的结束时间结束(在上面的示例中为 10000
)。
设计和实现一个API来帮助公司进行分析。
实现 TweetCounts
类:
TweetCounts()
初始化TweetCounts
对象。- 存储记录时间的
tweetName
(以秒为单位)。 List<integer> getTweetCountsPerFrequency(String freq, String tweetName, int startTime, int endTime)
返回一个整数列表,表示给定时间[startTime, endTime]
(单位秒)和频率频率中,每个 时间块 中带有tweetName
的tweet
的数量。freq
是“minute”
、“hour”
或“day”
中的一个,分别表示 每分钟 、 每小时 或 每一天 的频率。
示例:
输入: ["TweetCounts","recordTweet","recordTweet","recordTweet","getTweetCountsPerFrequency","getTweetCountsPerFrequency","recordTweet","getTweetCountsPerFrequency"] [[],["tweet3",0],["tweet3",60],["tweet3",10],["minute","tweet3",0,59],["minute","tweet3",0,60],["tweet3",120],["hour","tweet3",0,210]] 输出: [null,null,null,null,[2],[2,1],null,[4]] 解释: TweetCounts tweetCounts = new TweetCounts(); tweetCounts.recordTweet("tweet3", 0); tweetCounts.recordTweet("tweet3", 60); tweetCounts.recordTweet("tweet3", 10); // "tweet3" 发布推文的时间分别是 0, 10 和 60 。 tweetCounts.getTweetCountsPerFrequency("minute", "tweet3", 0, 59); // 返回 [2]。统计频率是每分钟(60 秒),因此只有一个有效时间间隔 [0,60> - > 2 条推文。 tweetCounts.getTweetCountsPerFrequency("minute", "tweet3", 0, 60); // 返回 [2,1]。统计频率是每分钟(60 秒),因此有两个有效时间间隔 1) [0,60> - > 2 条推文,和 2) [60,61> - > 1 条推文。 tweetCounts.recordTweet("tweet3", 120); // "tweet3" 发布推文的时间分别是 0, 10, 60 和 120 。 tweetCounts.getTweetCountsPerFrequency("hour", "tweet3", 0, 210); // 返回 [4]。统计频率是每小时(3600 秒),因此只有一个有效时间间隔 [0,211> - > 4 条推文。
提示:
0 <= time, startTime, endTime <= 109
0 <= endTime - startTime <= 104
recordTweet
和getTweetCountsPerFrequency
,最多有104
次操作。