Question: https://leetcode.com/problems/server-...
SQL Schema:
First pinned comment.
Pandas Schema:
data = [[4, '2023-11-29 20:22:50', 'start'], [4, '2023-11-30 04:19:50', 'stop'], [2, '2023-11-18 21:23:09', 'start'], [2, '2023-11-19 00:38:09', 'stop'], [5, '2023-11-27 18:38:16', 'start'], [5, '2023-11-28 02:46:16', 'stop'], [4, '2023-11-27 06:46:42', 'start'], [4, '2023-11-27 08:23:42', 'stop'], [5, '2023-11-11 05:09:45', 'start'], [5, '2023-11-11 06:42:45', 'stop'], [5, '2023-11-27 23:05:58', 'start'], [5, '2023-11-27 23:48:58', 'stop'], [5, '2023-11-14 16:29:34', 'start'], [5, '2023-11-14 19:11:34', 'stop'], [1, '2023-11-02 19:14:15', 'start'], [1, '2023-11-02 20:19:15', 'stop'], [5, '2023-11-03 06:55:30', 'start'], [5, '2023-11-03 11:03:30', 'stop'], [4, '2023-11-02 16:53:28', 'start'], [4, '2023-11-02 22:28:28', 'stop'], [2, '2023-11-20 07:06:41', 'start'], [2, '2023-11-20 15:58:41', 'stop'], [1, '2023-11-22 10:42:35', 'start'], [1, '2023-11-22 19:14:35', 'stop'], [3, '2023-11-23 03:05:39', 'start'], [3, '2023-11-23 10:54:39', 'stop'], [3, '2023-11-15 20:04:15', 'start'], [3, '2023-11-15 21:30:15', 'stop'], [3, '2023-11-12 08:21:42', 'start'], [3, '2023-11-12 17:07:42', 'stop'], [1, '2023-11-02 02:33:24', 'start'], [1, '2023-11-02 12:10:24', 'stop'], [4, '2023-11-14 03:55:29', 'start'], [4, '2023-11-14 08:53:29', 'stop'], [2, '2023-11-04 00:36:53', 'start'], [2, '2023-11-04 00:37:53', 'stop'], [4, '2023-11-08 01:54:18', 'start'], [4, '2023-11-08 09:56:18', 'stop'], [1, '2023-11-24 14:28:11', 'start'], [1, '2023-11-24 21:38:11', 'stop'], [3, '2023-11-20 22:55:03', 'start'], [3, '2023-11-21 02:19:03', 'stop'], [3, '2023-11-12 03:10:22', 'start'], [3, '2023-11-12 08:29:22', 'stop'], [2, '2023-11-02 14:55:46', 'start'], [2, '2023-11-02 16:56:46', 'stop'], [1, '2023-11-09 03:40:44', 'start'], [1, '2023-11-09 03:52:44', 'stop'], [5, '2023-11-16 17:43:28', 'start'], [5, '2023-11-16 20:45:28', 'stop'], [2, '2023-11-08 16:17:24', 'start'], [2, '2023-11-09 00:59:24', 'stop'], [4, '2023-11-25 04:46:06', 'start'], [4, '2023-11-25 11:56:06', 'stop'], [2, '2023-11-05 14:22:34', 'start'], [2, '2023-11-05 21:33:34', 'stop'], [1, '2023-11-02 09:49:22', 'start'], [1, '2023-11-02 15:01:22', 'stop'], [5, '2023-11-08 06:49:10', 'start'], [5, '2023-11-08 13:33:10', 'stop'], [1, '2023-11-22 21:00:23', 'start'], [1, '2023-11-22 22:43:23', 'stop'], [3, '2023-11-06 07:45:50', 'start'], [3, '2023-11-06 15:18:50', 'stop'], [3, '2023-11-02 22:13:17', 'start'], [3, '2023-11-03 03:50:17', 'stop'], [1, '2023-11-14 02:40:20', 'start'], [1, '2023-11-14 03:57:20', 'stop'], [1, '2023-11-08 21:13:00', 'start'], [1, '2023-11-09 01:22:00', 'stop'], [5, '2023-11-21 13:25:22', 'start'], [5, '2023-11-21 19:46:22', 'stop'], [5, '2023-11-16 04:37:55', 'start'], [5, '2023-11-16 12:53:55', 'stop'], [2, '2023-11-06 14:03:26', 'start'], [2, '2023-11-06 17:11:26', 'stop'], [2, '2023-11-11 08:18:54', 'start'], [2, '2023-11-11 12:34:54', 'stop'], [2, '2023-11-07 22:54:01', 'start'], [2, '2023-11-08 08:22:01', 'stop'], [5, '2023-11-23 14:08:03', 'start'], [5, '2023-11-23 22:23:03', 'stop'], [1, '2023-11-04 15:20:41', 'start'], [1, '2023-11-04 16:09:41', 'stop'], [3, '2023-11-05 01:24:32', 'start'], [3, '2023-11-05 10:09:32', 'stop'], [4, '2023-11-09 14:15:29', 'start'], [4, '2023-11-09 18:39:29', 'stop'], [3, '2023-11-28 21:43:00', 'start'], [3, '2023-11-29 06:06:00', 'stop'], [2, '2023-11-18 06:23:14', 'start'], [2, '2023-11-18 07:34:14', 'stop'], [5, '2023-11-09 17:27:02', 'start'], [5, '2023-11-10 03:00:02', 'stop'], [2, '2023-11-21 02:41:57', 'start'], [2, '2023-11-21 07:28:57', 'stop'], [3, '2023-11-08 00:36:12', 'start'], [3, '2023-11-08 01:47:12', 'stop'], [1, '2023-11-15 16:13:39', 'start'], [1, '2023-11-15 20:29:39', 'stop'], [3, '2023-11-03 06:25:01', 'start'], [3, '2023-11-03 11:14:01', 'stop'], [1, '2023-11-18 20:49:55', 'start'], [1, '2023-11-18 23:04:55', 'stop'], [3, '2023-11-13 05:02:21', 'start'], [3, '2023-11-13 12:44:21', 'stop'], [2, '2023-11-23 19:00:11', 'start'], [2, '2023-11-24 04:59:11', 'stop'], [4, '2023-11-20 01:16:38', 'start'], [4, '2023-11-20 01:35:38', 'stop'], [1, '2023-11-13 11:21:08', 'start'], [1, '2023-11-13 11:56:08', 'stop'], [4, '2023-11-21 23:09:45', 'start'], [4, '2023-11-22 00:26:45', 'stop'], [2, '2023-11-04 11:19:31', 'start'], [2, '2023-11-04 16:46:31', 'stop']]
servers = pd.DataFrame(columns=['server_id', 'status_time', 'session_status'], dtype={'server_id': 'int', 'status_time': 'datetime64[ns]', 'session_status': pd.CategoricalDtype(categories=['start', 'stop'])})
#leetcodesolutions #datascience #sql
Auf dieser Seite können Sie das Online-Video Leetcode MEDIUM 3126 - Server Utilization Time CTEs SELF JOIN - Explained by Everyday Data Science mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Everyday Data Science 26 Juli 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 279 Mal angesehen und es wurde von 12 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!