It's been a tough week at work and you are stuggling to get out of bed in the morning.

While waiting at the bus stop you realise that if you could time your arrival to the nearest minute you could get valuable extra minutes in bed.

There is a bus that goes to your office every 15 minute, the first bus is at `06:00`, and the last bus is at `00:00`.

Given that it takes 5 minutes to walk from your front door to the bus stop, implement a function that when given the curent time will tell you much time is left, before you must leave to catch the next bus.

## Examples

```
"05:00"  =>  55
"10:00"  =>  10
"12:10"  =>  0
"12:11"  =>  14
```

### Notes

1. Return the number of minutes till the next bus
2. Input will be formatted as `HH:MM` (24-hour clock)
3. The input time might be after the buses have stopped running, i.e. after `00:00`

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def bus_timer(current_time):
	

Solutions:
def bus_timer(current_time):
	(h, m) = map(int, current_time.split(':'))
	if h < 6:
		m = (5 - h) * 60 + 60 - m
	elif h == 23 and m > 55:
		return 355 + 60 - m
	else:
		m = 15 - m % 15
	if m > 4:
		return m - 5
	else:
		return m + 10


def bus_timer(time):
	(h, m) = map(int, time.split(':'))
	t = (5 + h * 60 + m) % 1440
	return -t % (360 if t < 360 else 15)


from datetime import datetime, timedelta

def bus_timer(current_time):
	ct = datetime.strptime(current_time, '%H:%M')
	if ct >= datetime.strptime('5:55', '%H:%M') and ct <= datetime.strptime('23:55', '%H:%M'):
		if ct.minute <= 10:
			time_left = 10 - ct.minute
		elif ct.minute <= 25 and ct.minute > 10:
			time_left = 25 - ct.minute
		elif ct.minute <= 40 and ct.minute > 25:
			time_left = 40 - ct.minute
		elif ct.minute <= 55 and ct.minute > 40:
			time_left = 55 - ct.minute
		else:
			time_left = 70 - ct.minute
	else:
		delta = datetime.strptime('5:55', '%H:%M') - ct
		time_left = int(delta.seconds / 60)
	return time_left


def bus_timer(current_time):
	(h, m) = map(int, current_time.split(':'))
	current_time = 60 * h + m
	if current_time >= 1436 or current_time <= 355:
		return (355 - current_time) % 1440
	else:
		return (10 - current_time) % 15


def bus_timer(time):
	c = time.split(':')
	z = int(c[1]) + 5
	t = 0
	if int(c[0]) == 23 and int(c[1]) >= 55:
		c[0] = 0
		c[1] = int(c[1]) + 5 - 60
		if int(c[1]) == 0:
			t = 0
		elif int(c[1]) > 0:
			t = (5 - int(c[0])) * 60 + (60 - int(c[1]))
	elif int(c[0]) == 5 and int(c[1]) >= 55:
		c[0] = 6
		c[1] = int(c[1]) + 5 - 60
		if int(c[1]) == 0:
			t = 0
		elif int(c[1]) > 0:
			t = 15 - int(c[1])
	elif int(c[0]) < 6:
		if int(c[1]) == 0:
			t = (6 - int(c[0])) * 60 - 5
		elif int(c[1]) > 0:
			t = (5 - int(c[0])) * 60 + (60 - int(c[1])) - 5
	else:
		if z > 60:
			z = z - 60
		if z < 15:
			t = 15 - z
		elif z > 15 and z < 30:
			t = 30 - z
		elif z > 30 and z < 45:
			t = 45 - z
		elif z > 45:
			t = 60 - z
	return t


def bus_timer(current_time):
	(hh, mm) = [int(v) for v in current_time.split(':')]
	time = (hh * 60 + mm + 5) % 1440
	if time == 0:
		return 0
	if time <= 360:
		return 360 - time
	return -time % 15


def bus_timer(time):
	(hh, mm) = time.split(':')
	(hh, mm) = (int(hh), int(mm))
	if hh == 23:
		if mm <= 55:
			return 10 - mm % 15 if mm % 15 <= 10 else 15 - (mm % 15 - 10)
		else:
			return 5 * 60 + 55 + (60 - mm)
	elif 6 <= hh:
		return 10 - mm % 15 if mm % 15 <= 10 else 15 - (mm % 15 - 10)
	return (5 - hh) * 60 + (55 - mm) if hh < 5 or (hh == 5 and mm <= 55) else 15 - (mm % 15 - 10)


def bus_timer(time):
	print(time)
	(hour, mins) = map(int, time.split(':'))
	mins += hour * 60
	if 0 <= mins < 355 or mins > 1435:
		return 355 - mins + 1440 * (mins > 1435)
	mins = 10 - mins + mins // 15 * 15
	return mins + 15 * (mins < 0)


def bus_timer(current_time):
	(h, m) = list(map(int, current_time.split(':')))
	t = h * 60 + m - 55
	if t < 60 * 5 or t > 23 * 60:
		return (5 + 24 * (h == 23)) * 60 - t
	return min((a - m for a in (10, 25, 40, 55, 70) if a - m >= 0))


def bus_timer(current_time):
	tim = current_time[3:]
	time = int(tim)
	tume = int(current_time[:2])
	if tume == 5 and time > 55:
		return 60 - time + 15 - 5
	elif tume < 6 and tume >= 0:
		return (6 - tume) * 60 - 5 - time
	elif tume == 23 and time > 55:
		return 360 - 5 + 60 - time
	elif time < 15 and time <= 10:
		return 15 - time - 5
	elif time < 30 and time <= 25:
		return 30 - time - 5
	elif time < 45 and time <= 40:
		return 45 - time - 5
	elif time < 15 and time > 10:
		return 30 - time - 5
	elif time < 30 and time > 25:
		return 45 - time - 5
	elif time < 45 and time > 40:
		return 60 - time - 5
	elif time < 60 and time > 55:
		return 75 - time - 5
	else:
		return 60 - time - 5