Shawn's Blog

  • Home
  • Tags
  • Categories
  • Archives
  • Search
  • Table of Contents
  • Overview

Shawn

若有恒,何必三更眠五更起;最无益,莫过一日曝十日寒。
393 posts
14 categories
117 tags

LeetCode 1736. Latest Time by Replacing Hidden Digits

Posted on 2021-07-24 In LeetCode
1
2
3
4
5
6
7
8
9
10
11
class Solution {
public:
string maximumTime(string time) {
string ans = time;
if (time[0] == '?') ans[0] = time[1] != '?' && time[1] > '3' ? '1' : '2';
if (time[1] == '?') ans[1] = ans[0] == '2' ? '3' : '9';
if (time[3] == '?') ans[3] = '5';
if (time[4] == '?') ans[4] = '9';
return ans;
}
};
# String
AcWing 3779. 相等的和
LeetCode 1941. Check if All Characters Have Equal Number of Occurrences
© 2026 Shawn
Powered by Hexo & NexT.Mist
0%