Generate maximum HH:MM from a list of 4 integers
<p>Note: Another question is the duplicate of this one. If I posted this question 6 months earlier than that one, then how can mine be a duplicate?</p>

<p>I have 4 non-negative integers a,b,c,d. All of them are less than or equal to 9. I have to return the maximum time that can be shown on the clock in 24-hour format.</p>

<p>For example: a=9, b=4, c=3, d=1, would yield 19:43</p>

<p>I have so far only been able to come up with brute-force approach which kind of tests all 24-possible combinations. Although this isn't too bad, I was wondering if there are more elegant approaches. All ideas better than brute force are welcome.  </p>

<p>Note: It is not a homework question. I got this from an interview prep site but has no solutions there.</p>