Rajesh Yadav

Rajesh Yadav

  • NA
  • 105
  • 8.3k

Find maximum valid time that can be displayed C#

Jul 16 2018 4:51 AM
Format 4 numbers into a 24-hour time (00:00), finding the maximum (latest) time possible, taking into account that the given digits 1,8,3,2 the maximum valid time is 23:18. If not possible, return NOT POSSIBLE.  So for example:  6, 5, 2, 0 would be 20:56  3, 9, 5, 0 would be 09:53  7, 6, 3, 8 would be NOT POSSIBLE  The example function that had to return the time or string looked like this, A, B, C, D being a different number from the comma-separated list above:  function generate(A, B, C, D) {     // Your code here }