Skip to content

Latest commit

 

History

History

10. Minimum Waiting Time

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Problem 10 - Minimum Waiting Time


Problem Definition

Given an array of positive integers. Each integer in the input array represents the duration of a query that needs to be executed.

Write a function that is going to return the minimum amount of total waiting time for all the queries.

Waiting time - Amount of time a query waites till it starts executing.

Aim: Solve with Minimum Time Complexity and Space Complexity.

Important Considerations

  • Only one query can be executed at a time.
  • Queries can be executed in any order.
  • Mutatation of the input array is allowed.
  • Atleast one query is given.

Example

# list of integers (waiting times)

coins = [3, 2, 1, 2, 6]

# Function must return 17 which is the total minimum waiting time

Solutions

  1. Python Implementations: Solution
  2. Java Implementations: Solution
  3. JavaScript Implementations: Solution