2933. High-Access Employees Medium
1/**
2 * [2933] High-Access Employees
3 *
4 * You are given a 2D 0-indexed array of strings, access_times, with size n. For each i where 0 <= i <= n - 1, access_times[i][0] represents the name of an employee, and access_times[i][1] represents the access time of that employee. All entries in access_times are within the same day.
5 * The access time is represented as four digits using a 24-hour time format, for example, "0800" or "2250".
6 * An employee is said to be high-access if he has accessed the system three or more times within a one-hour period.
7 * Times with exactly one hour of difference are not considered part of the same one-hour period. For example, "0815" and "0915" are not part of the same one-hour period.
8 * Access times at the start and end of the day are not counted within the same one-hour period. For example, "0005" and "2350" are not part of the same one-hour period.
9 * Return a list that contains the names of high-access employees with any order you want.
10 *
11 * <strong class="example">Example 1:
12 *
13 * Input: access_times = [["a","0549"],["b","0457"],["a","0532"],["a","0621"],["b","0540"]]
14 * Output: ["a"]
15 * Explanation: "a" has three access times in the one-hour period of [05:32, 06:31] which are 05:32, 05:49, and 06:21.
16 * But "b" does not have more than two access times at all.
17 * So the answer is ["a"].
18 * <strong class="example">Example 2:
19 *
20 * Input: access_times = [["d","0002"],["c","0808"],["c","0829"],["e","0215"],["d","1508"],["d","1444"],["d","1410"],["c","0809"]]
21 * Output: ["c","d"]
22 * Explanation: "c" has three access times in the one-hour period of [08:08, 09:07] which are 08:08, 08:09, and 08:29.
23 * "d" has also three access times in the one-hour period of [14:10, 15:09] which are 14:10, 14:44, and 15:08.
24 * However, "e" has just one access time, so it can not be in the answer and the final answer is ["c","d"].
25 * <strong class="example">Example 3:
26 *
27 * Input: access_times = [["cd","1025"],["ab","1025"],["cd","1046"],["cd","1055"],["ab","1124"],["ab","1120"]]
28 * Output: ["ab","cd"]
29 * Explanation: "ab" has three access times in the one-hour period of [10:25, 11:24] which are 10:25, 11:20, and 11:24.
30 * "cd" has also three access times in the one-hour period of [10:25, 11:24] which are 10:25, 10:46, and 10:55.
31 * So the answer is ["ab","cd"].
32 *
33 * Constraints:
34 *
35 * 1 <= access_times.length <= 100
36 * access_times[i].length == 2
37 * 1 <= access_times[i][0].length <= 10
38 * access_times[i][0] consists only of English small letters.
39 * access_times[i][1].length == 4
40 * access_times[i][1] is in 24-hour time format.
41 * access_times[i][1] consists only of '0' to '9'.
42 *
43 */
44pub struct Solution {}
45
46// problem: https://leetcode.com/problems/high-access-employees/
47// discuss: https://leetcode.com/problems/high-access-employees/discuss/?currentPage=1&orderBy=most_votes&query=
48
49// submission codes start here
50
51impl Solution {
52 pub fn find_high_access_employees(access_times: Vec<Vec<String>>) -> Vec<String> {
53 vec![]
54 }
55}
56
57// submission codes end
58
59#[cfg(test)]
60mod tests {
61 use super::*;
62
63 #[test]
64 fn test_2933() {
65 }
66}
67
Back
© 2025 bowen.ge All Rights Reserved.