и посмотреть медиа
Java | LeetCode
и посмотреть медиа
LeetCode tasks and solutions in Java.
AI bot for text-to-speech and voice cloning in Telegram. Create audio using neural network quickly and easily.
LeetCode task solutions in Java with emphasis on clean code and optimization. Topics: arrays, trees, graphs, dynamic programming. Ideal for technical preparation.
Задача: 786. K-th Smallest Prime Fraction Сложность: medium Вам дан отсортированный массив целых чисел arr, содержащий 1 и простые числа, где все элементы массива arr уникальны. Также дано целое число k. Для каждого i и j, где 0 Double.compare((double)arr[a[0]] / arr[a[1]], (double)arr[b[0]] / arr[b[1]])); for (int i = 0; i < arr.length - 1; i++) { pq.offer(new int[]{i, arr.length - 1}); } for (int i = 0; i < k - 1; i++) { int[] cur = pq.poll(); if (cur[1] - 1 > cur[0]) { pq.offer(new int[]{cur[0], cur[1] - 1}); } } int[] result = pq.poll(); return new int[]{arr[result[0]], arr[result[1]]}; } } Ставь 👍 и забирай 📚 Базу знаний
Открыть канал и посмотреть медиаOnly registered users can share their opinion.
Be the first to share your impression of this resource!