I received hundreds of transactions within one week. Each transaction has amount. I’d like to create an algorithm to find the maximum amount within 24 hour time window period. I know how to do that by creating a nested loop. But I am looking for a better performance algorithm such as n*Log(n) time complexity.

For example, the transaction data looks like:

`[ {'05-05-2019:10.00.00', 100}, {'05-05-2019:11.00.00', 100}, {'05-05-2019:12.00.00', 100}, {'05-06-2019:10.00.00', 100}, {'05-06-2019:11.00.00', 100}, {'05-07-2019:10.30.00', 100} ] `

For the above data, there are 6 transactions across 2 days. When calculate the 24 hours period time of transactions, there are 4 time period. The first three transactions happens within 24 hours which has a total amount as 300. The second time period includes three transactions, 2ed, 3rd and 4th which has a total of 300 amount. The third time period is 3rd, 4th and 5th has 300 amount. The fourth time period is 4th and 5th which is 200. The last time period is the last two which is 200. So the maximum amount is 300.