Category: Amazon-Question

Minimum time required to schedule K processes

  import java.util.*;import java.lang.*;  class GFG {              static int minTime(int[] A, int n, int K)    {                int max_ability = A[0];                  for (int i = 1; i < n; i++) {            max_ability = Math.max(                max_ability, A[i]);        }                  int tmp[] = new int[max_ability + 1];                          int count = 0;                  for (int i = 0; i < n; i++) {            tmp[A[i]]++;        }                  for (int i = max_ability;             i >= 0; i–) {              if (tmp[i] != […]

Continue Reading