Untitled
unknown
plain_text
14 days ago
452 B
2
Indexable
Never
public static long findMaxK(int n, long c, int d, int[] arr) { Arrays.sort(arr); int low = 0; int high = d; long result = -1; while (low <= high) { int mid = (low + high) / 2; if (canAchieveTarget(n, c, d, arr, mid)) { result = mid; low = mid + 1; } else { high = mid - 1; } } return result; }
Leave a Comment