In this Kata, you will be given a series of times at which an alarm goes off. Your task will be to determine the maximum time interval between alarms. Each alarm starts ringing at the beginning of the corresponding minute and rings for exactly one minute. The times in the array are not in chronological order. Ignore duplicate times, if any.

```Haskell
For example:
solve(["14:51"]) = "23:59". If the alarm goes off now, it will not go off for another 23 hours and 59 minutes.
solve(["23:00","04:22","18:05","06:24"]) == "11:40". The max interval that the alarm will not go off is 11 hours and 40 minutes.
```
In the second example, the alarm goes off `4` times in a day.

More examples in test cases. Good luck!

Difficulty: EASY
Tags: String algorithms

Starter code:
def solve(arr):
	

Solutions:
from datetime import datetime

def solve(arr):
	dts = [datetime(2000, 1, 1, *map(int, x.split(':'))) for x in sorted(arr)]
	delta = max((int((b - a).total_seconds() - 60) for (a, b) in zip(dts, dts[1:] + [dts[0].replace(day=2)])))
	return '{:02}:{:02}'.format(*divmod(delta // 60, 60))


def solve(arr):
	arr = sorted((int(m[:2]) * 60 + int(m[3:]) for m in set(arr)))
	arr += [arr[0] + 1440]
	(h, m) = divmod(max((arr[i + 1] - arr[i] - 1 for i in range(len(arr) - 1))), 60)
	return '{:02}:{:02}'.format(h, m)


def solve(arr):
	sorted_arr = sorted(arr, reverse=True)
	sorted_as_min = list(map(time_to_minutes, sorted_arr))
	windows = list(zip(sorted_as_min, sorted_as_min[1:]))
	differences = list(map(lambda w: w[0] - w[1], windows))
	differences.append(24 * 60 - sorted_as_min[0] + sorted_as_min[-1])
	return minutes_to_time(max(differences) - 1)

def time_to_minutes(time):
	(hr, min) = time.split(':')
	return int(hr) * 60 + int(min)

def minutes_to_time(minutes):
	return '{H:0=2d}:{M:0=2d}'.format(H=minutes // 60, M=minutes % 60)


def solve(arr):
	k = sorted((int(x[:2]) * 60 + int(x[3:]) for x in arr))
	z = [(k[i] - k[i - 1]) % 1440 for i in range(len(k))]
	return len(k) > 1 and '{:02}:{:02}'.format(*divmod(max(z) - 1, 60)) or '23:59'


def minutes(s):
	return int(s[0:2]) * 60 + int(s[-2:])

def timeformat(m):
	return '{:02d}:{:02d}'.format(m // 60, m % 60)

def solve(arr):
	arr = list(set(arr))
	m = [minutes(arr) for arr in sorted(arr)]
	difference = [(m[(i + 1) % len(m)] - a - 1) % (60 * 24) for (i, a) in enumerate(m)]
	return timeformat(max(difference))


def solve(arr):
	m = sorted((int(t[:2]) * 60 + int(t[-2:]) for t in arr))
	difs = [m[i + 1] - m[i] - 1 for i in range(len(m) - 1)]
	difs.append(1440 - m[-1] + m[0] - 1)
	maxd = max(difs)
	return f'{str(maxd // 60).zfill(2)}:{str(maxd % 60).zfill(2)}'


def solve(times):

	def to_minutes(time):
		(hh, mm) = time.split(':')
		return int(hh) * 60 + int(mm)
	times = sorted((to_minutes(time) for time in times))
	times.append(times[0] + 24 * 60)
	result = max((b - a - 1 for (a, b) in zip(times, times[1:])))
	return '{:02d}:{:02d}'.format(*divmod(result, 60))


def solve(times):
	mins = sorted((int(t[:2]) * 60 + int(t[3:]) for t in set(times)))
	mins += [mins[0] + 1440]
	max_time = max((b - a - 1 for (a, b) in zip(mins, mins[1:])))
	return '%02d:%02d' % divmod(max_time, 60)


from datetime import timedelta

def solve(arr):
	max = 0
	a = list(dict.fromkeys(arr))
	new_list = []
	if len(a) > 1:
		for i in enumerate(a):
			new_list.append(str(i[1].replace(':', '')))
		new_list.sort()
		new_list.reverse()
		for i in enumerate(new_list):
			if i[0] <= len(new_list) - 2:
				delta_hours = int(i[1][:2]) - int(new_list[i[0] + 1][:2])
				delta_mins = int(i[1][2:]) - int(new_list[i[0] + 1][2:]) - 1
				t = str(timedelta(hours=delta_hours, minutes=delta_mins))[:-3]
				c = int(t.replace(':', ''))
				if c >= max:
					max = c
					result = t
			if i[0] == len(new_list) - 1:
				loop_hrs = int(i[1][:2]) - int(new_list[0][:2]) + 24
				loop_mins = int(i[1][2:]) - int(new_list[0][2:]) - 1
				d = str(timedelta(hours=loop_hrs, minutes=loop_mins))[:-3]
				c = int(d.replace(':', ''))
				if c >= max:
					result = d
		if len(result) == 4:
			result = '0' + result
		return result
	else:
		return '23:59'


solve = lambda a: (lambda s: '%02d:%02d' % divmod(max(((b - a - 1) % 1440 for (a, b) in zip(s, s[1:] + s))), 60))(sorted({60 * int(t[:2]) + int(t[3:]) for t in a}))