Java Watch Displays Current Time 24 Hour Format Look Digits Used Display Time Wonder Last Q37273848

JAVA: You have a watch that displays the current time in 24-hourformat. you look at the digits used to display the time and wonder:what was the last time that could be displayed using the samesubset of digits?

Write a function:

             class Solution { public String solution(String S); }

that, given a non-empty string S in “HH : MM” formatrepresenting the current time on your watch, returns the string Tin the same format, specifying the latest time before that can berepresented by a subset of the digits of S (note that not alldigits from S have to be used).

For example, given “11 : 01”

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.