五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Leetcode2437. Number of Valid Clock Times

2023-01-02 08:59 作者:您是打尖兒還是住店呢  | 我要投稿

You are given a string of length?5?called?time, representing the current time on a digital clock in the format?"hh:mm". The?earliest?possible time is?"00:00"?and the?latest?possible time is?"23:59".

In the string?time, the digits represented by the???symbol are?unknown, and must be?replaced?with a digit from?0?to?9.

Return?an integer?answer, the number of valid clock times that can be created by replacing every???with a digit from?0?to?9.

?

Example 1:

Input: time = "?5:00"Output: 2Explanation: We can replace the ? with either a 0 or 1, producing "05:00" or "15:00". Note that we cannot replace it with a 2, since the time "25:00" is invalid. In total, we have two choices.

Example 2:

Input: time = "0?:0?"Output: 100Explanation: Each ? can be replaced by any digit from 0 to 9, so we have 100 total choices.

Example 3:

Input: time = "??:??"Output: 1440Explanation: There are 24 possible choices for the hours, and 60 possible choices for the minutes. In total, we have 24 * 60 = 1440 choices.

?

Constraints:

  • time?is a valid string of length?5?in the format?"hh:mm".

  • "00" <= hh <= "23"

  • "00" <= mm <= "59"

  • Some of the digits might be replaced with?'?'?and need to be replaced with digits from?0?to?9.

  • 難度等級:Easy

只要知道小時的可能性跟分鐘的可能是單獨(dú)即可,

先去判斷小時的可能性,如果2個都是?,是多少個,如果第1個是?,多少個,如果第2個是?,多少個,同理判斷分鐘的可能性;

最后返回小時跟分鐘可能性的乘積即可。

Runtime0 ms

Beats

100%

Memory39.8 MB

Beats

94.41%

Click to check the distribution chart


Leetcode2437. Number of Valid Clock Times的評論 (共 條)

分享到微博請遵守國家法律
山西省| 焉耆| 平江县| 常熟市| 衡水市| 泸州市| 泽州县| 抚顺县| 叙永县| 延长县| 青田县| 丽江市| 大连市| 呼伦贝尔市| 北碚区| 紫阳县| 开鲁县| 金寨县| 宜昌市| 林口县| 临沂市| 玛沁县| 邯郸县| 闵行区| 峡江县| 武汉市| 彩票| 运城市| 湟中县| 银川市| 侯马市| 林甸县| 射阳县| 宁海县| 庄河市| 罗江县| 通城县| 财经| 萨嘎县| 扶绥县| 敦煌市|