Java Hyd Team
745 subscribers
986 photos
39 videos
670 files
690 links
https://teamhydteam.my.canva.site/

Can visit us on our website ๐Ÿ˜Š
Still working on it ๐Ÿ˜Š
Download Telegram
Apply here
Openings for everyone in Java n react
Amazing journey ๐Ÿฅณ๐Ÿ‘
Am looking for Java spring boots - 5 positions for remote work.

0 - 2yrs experience required.
Budget : upto 30k/month

Freshers - will be paid basis assessments on the task assigned. First month no salary (further induction will be purely on adoption and dedication to the learning)

Send profiles to hr@hireright.work

Job location : Remote
Assets: BYOD (self sponsored laptop)
I want few developers who are very good at JAVA, ANGULAR, FLUTTER for my own project can pay them around 10k per month
Forwarded from Aman Raj
1. Process Allocation
There are n processes to be executed, and the ith process has a size of processSize[i], where 1 โ‰ค i โ‰ค n. Also, there are m processors of different size capacity. The capacity of the ith processor is capacity[i] (1 โ‰ค i โ‰ค m). A processor can process a task of size less than or equal to its capacity in 1 second, but it cannot execute processes whose size is greater than its capacity.



A processor can execute multiple processes one after the other, but needs to pause for 1 second after completing its current one. Multiple processors can work on different processes simultaneously.



Find the minimum time to execute all the processes or return -1 if there is no way to execute all the processes.



Example

It is given that n = 3, processSize = [2, 5, 3], m = 3 and capacity = [6, 2, 4].

The optimal way to assign processes is to give the first processor the second process, the second processor the first process, and the third processor the third process. All of them complete their processes in 1 second.

Therefore, the minimum time required is 1 second.



Function Description

Complete the function getMinimumTime in the editor below.



getMinimumTime has the following parameters:

int processSize[n]: the size of each process

int capacity[m]: the capacity of each processor



Returns

int: the minimum time required to execute all the processes, or -1 if there is no way to execute all processes.



Constraints

1 โ‰ค n, m โ‰ค 2 * 105
1 โ‰ค processSize[i], capacity[i] โ‰ค 109


Input Format For Custom Testing
The first line contains an integer n, the number of processes.

The next n lines contain processSize[i] (1 โ‰ค i โ‰ค n).

The following line contains an integer m, the number of processors.

The next m lines contain capacity[i] (1 โ‰ค i โ‰ค m).

Sample Case 0
Sample Input For Custom Testing

STDIN FUNCTION
----- --------
3 โ†’ processSize[] size n = 3
2 โ†’ processSize = [2, 5, 8]
5
8
3 โ†’ capacity[] size m = 3
6 โ†’ capacity = [6, 7, 4]
7
4
Sample Output

-1
Explanation

No processor has the required capacity to process the third process, so there is no way to process them all.

Sample Case 1
Sample Input For Custom Testing

STDIN FUNCTION
----- --------
5 โ†’ processSize[] size n = 5
1 โ†’ processSize = [1, 2, 3, 4, 6]
2
3
4
6
3 โ†’ capacity[] size n = 3
4 โ†’ capacity = [4, 7, 4]
7
4
Sample Output

3
Explanation

Assign the second and third process to the first processor. It completes the first process in 1 second, then pauses for another second, before completing the third process. Therefore, it takes 3 seconds to complete all of its work.

Similarly, assign the first and fifth process to the second processor. It also completes its processes in 3 seconds. The fourth process is completed by the third processor in 1 second.

Hence, all of the processes are completed in 3 seconds.