{"id":9989,"date":"2023-04-27T21:18:16","date_gmt":"2023-04-28T04:18:16","guid":{"rendered":"https:\/\/zxi.mytechroad.com\/blog\/?p=9989"},"modified":"2023-04-27T21:19:33","modified_gmt":"2023-04-28T04:19:33","slug":"leetcode-2651-calculate-delayed-arrival-time","status":"publish","type":"post","link":"https:\/\/zxi.mytechroad.com\/blog\/math\/leetcode-2651-calculate-delayed-arrival-time\/","title":{"rendered":"\u82b1\u82b1\u9171 LeetCode 2651. Calculate Delayed Arrival Time"},"content":{"rendered":"\n<p>You are given a positive integer&nbsp;<code>arrivalTime<\/code>&nbsp;denoting the arrival time of a train in hours, and another positive integer&nbsp;<code>delayedTime<\/code>&nbsp;denoting the amount of delay in hours.<\/p>\n\n\n\n<p>Return&nbsp;<em>the time when the train will arrive at the station.<\/em><\/p>\n\n\n\n<p>Note that the time in this problem is in 24-hours format.<\/p>\n\n\n\n<p><strong>Example 1:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted;crayon:false\"><strong>Input:<\/strong> arrivalTime = 15, delayedTime = 5 \n<strong>Output:<\/strong> 20 \n<strong>Explanation:<\/strong> Arrival time of the train was 15:00 hours. It is delayed by 5 hours. Now it will reach at 15+5 = 20 (20:00 hours).\n<\/pre>\n\n\n\n<p><strong>Example 2:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted;crayon:false\"><strong>Input:<\/strong> arrivalTime = 13, delayedTime = 11\n<strong>Output:<\/strong> 0\n<strong>Explanation:<\/strong> Arrival time of the train was 13:00 hours. It is delayed by 11 hours. Now it will reach at 13+11=24 (Which is denoted by 00:00 in 24 hours format so return 0).\n<\/pre>\n\n\n\n<p><strong>Constraints:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>1 &lt;= arrivaltime &lt;&nbsp;24<\/code><\/li><li><code>1 &lt;= delayedTime &lt;= 24<\/code><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Solution: Mod 24<\/strong><\/h2>\n\n\n\n<div class=\"responsive-tabs\">\n<h2 class=\"tabtitle\">C++<\/h2>\n<div class=\"tabcontent\">\n\n<pre lang=\"c++\">\/\/ Author: Huahua\nclass Solution {\npublic:\n  int findDelayedArrivalTime(int arrivalTime, int delayedTime) {\n    return (arrivalTime + delayedTime) % 24;\n  }\n};\n<\/pre>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>You are given a positive integer&nbsp;arrivalTime&nbsp;denoting the arrival time of a train in hours, and another positive integer&nbsp;delayedTime&nbsp;denoting the amount of delay in hours. Return&nbsp;the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-9989","post","type-post","status-publish","format-standard","hentry","category-math","entry","simple"],"_links":{"self":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts\/9989","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/comments?post=9989"}],"version-history":[{"count":2,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts\/9989\/revisions"}],"predecessor-version":[{"id":9991,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts\/9989\/revisions\/9991"}],"wp:attachment":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/media?parent=9989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/categories?post=9989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/tags?post=9989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}