2. Task Scheduling Given an array task_memory of n positive integers representing the amount of memory required to process each task, an array task_type of n positive integers representing the type of each task, and an integer max_memory, find the minimum amount of time required for the server to process all the tasks. Each task takes 1 unit of time to process. The server can process at most two tasks in parallel only if they are of the same type and together require no more than max_memory units of memory. Example Suppose n = 4, task_memory = [7, 2, 3, 9], task_type = [1, 2, 1, 3], and max_memory = 10. One efficient schedule is shown. Task Pair - Task 1 - Task 2 - Task Type - Memory Requirement - Within Max Memory - Can Process in Parallel 1 - 0 - 2 - Same - 7+3=10 - Yes - Yes 2 - 1 - 3 - Different - 9+2=11 - No - No Tasks 0 and 2 are processed concurrently, but the other two must be processed separately due to their memory requirements and because they are not the same type. The minimum amount of time required to process all the tasks is 3 units. Function Description Complete the function getMinTime in the editor below. getMinTime has the following parameter(s): int task_memory[n]: the memory required by the tasks int task_type[n]: the type of the tasks int max_memory: the maximum total memory that can be allocated to the tasks Returns int: the minimum time required to process all tasks Constraints 1 ≤ n ≤2*105 • 1 ≤ max_memory≤ 109 • 1 ≤ task_memory[i] < max_memory • 1 ≤ task_type[i] ≤ 109 ▼Input Format For Custom Testing The first line contains an integer, n, the number of elements in task_memory. The following n lines contain an integer, task_memory[i]. The next line contains an integer, n, the number of elements in task_type. The following n lines contain an integer, task_type[i]. The last line contains an integer, max_memory. ▼Sample Case 0 Sample Input For Custom Testing STDIN FUNCTION 5 n = 5 1 task_memory = [1, 2, 3, 4, 2] 2 3 4 2 5 n = 5 1 task_type = [1, 2, 1, 2, 3] 2 1 2 3 4 max_memory = 4 Sample Output 4 Explanation The first and the third tasks are processed in parallel. The other three tasks need to be processed individually. The second and fourth use too much memory together, and the fifth is a unique type. ▼Sample Case 1 Sample Input For Custom Testing STDIN FUNCTION 3 n = 3 1 task_memory = [1, 2, 5] 2 5 3 n = 3 1 type = [1, 2, 3] 2 3 6 max_memory = 6 Sample Output 3 Explanation All the tasks are of different types and must be processed separately. please use public static int getMinTime(List task_memory, List task_type, int max_memory) test samples public static void main(String[] args) { List task_memory = List.of(1, 2, 3, 4, 2); List task_type = List.of(1, 2, 1, 2, 3); int max_memory = 4; System.out.println(getMinTime(task_memory, task_type, max_memory)); // Output: 4 // Example usage: task_memory = List.of(20, 17, 18, 13, 11, 13, 19, 15, 13, 10, 13, 12, 11, 15, 19, 16, 10, 11, 14, 18, 19); task_type = List.of(20, 4, 3, 4, 1, 1, 3, 3, 4, 2, 2, 4, 3, 5, 1, 3, 4, 3, 2, 3, 1); max_memory = 213; System.out.println(getMinTime(task_memory, task_type, max_memory)); // Output: 12 }