Question: write a function class solution { public int solution ( int [ ] T ) ; } For example for T = [ 3 ,

write a function class solution { public int solution (int[] T);}For example for T=[3,1,2], the employee spends 6 hours making items in the following
order: 1,2,3,1,3,1. The first client waited 6 hours for their item, the second cffient
reselved their item after 2 hours and the third client after 5 hours. What is the total time
that clients need to wait for all ordered items? For the above example, the answer is 6+
2+5=13.
As the result may be large, return its last nine digits without leadling zeros (in other
words, return the result modulo 10%.
Write a function:
class Solution { public int solution(int[] T) : }
that, given an array of integers T of length N, returns the total time that the clients need
to wail (modulo 10%).
Examples:
Given T={3,1,2}, the function should return 13 as explained above.
Given T={1,2,3,4}, the function should return 24. The employee prepares the items
in the following order: 1,2,3,4,2,3,4,3,4,4. The first client waited for 1 houn the
second client for 5 hours, the third client for 8 hours, and the fourth client for 10 hours.
The total waiting time of all cllients is 1+5+8+10=24 hours.
Given T=17,7,7, the function should return 60.
Eiven J=[10000}, the function should return 10000.
Write an efficient algorithm for the following assumptions:
 write a function class solution { public int solution (int[] T);}For

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!