Math, asked by akshaigv7088, 1 year ago

Generate maximum hh:mm:ss from a list of 9 integers

Answers

Answered by zagreb
0

The nine integers to be used are 1,2,3,4,5,6,7,8,9,

Case1)

Digits cannot be repeated

Now for the maximum hours we can have 23 as 24 hours then needs 0's.

Now for the maximum minutes we can have 59 as making it 60 adds an hour.

2,4,5,& 9 are gone.

We are left with 1,3,6,7,8

From this the maximum number of seconds we can generate are 38 as 6, 7 & 8 cannot be at the tens place.

Hence the maximum time shall be 23:59:38

Case 2)

Digits can be repeated

In that case

Maximum hours shall be 23

Maximum minutes shall be 59

Maximum seconds shall be 59

The maximum time shall be 24:59:59

Similar questions