Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
using dictionaries to see in wich day the duration must count on solution in Clear category for Call to Home by EdinsonUwU
from typing import List
import math
def total_cost(calls: List[str]) -> int:
segundosCadaDia = {}
for i in calls:
if i[:10] not in segundosCadaDia.keys():
segundosCadaDia[i[:10]] = math.ceil(int(i[20:])/60)
else:
segundosCadaDia[i[:10]] = int(segundosCadaDia[i[:10]]) + math.ceil(int(i[20:])/60)
totalCoins = 0
for i in segundosCadaDia.values():
if i <= 100:
totalCoins = totalCoins + i
else:
totalCoins = totalCoins + (i-100)*2 + 100
return totalCoins
May 22, 2021