Logo
TGCATALOG
Catalog Collections Blog
Kotlin | LeetCode

Kotlin | LeetCode

LeetCode problems and solutions in Kotlin.

No ratings
431
02.12.2026
431
02.12.2026
No ratings
431
02.12.2026
Safe redirect via bot
О канале

LeetCode problems and solutions in Kotlin.

Подписчиков —
Тематика Technology
Ссылка @easy_kotlin_task

We also recommend

Kekaton AI | Voiceover and voice clone
Kekaton AI | Voiceover and voice clone
Bot

AI bot for text-to-speech and voice cloning in Telegram. Create audio using neural network quickly and easily.

Description

LeetCode problem solutions in Kotlin. Optimized code for mobile developers and algorithm specialists.

Latest posts

Kotlin | LeetCode
Kotlin | LeetCode
🔒Открыть пост
и посмотреть медиа
Задача: 1229. Meeting Scheduler Сложность: medium Даны массивы доступных временных слотов slots1 и slots2 для двух человек и продолжительность встречи duration, верните самый ранний временной слот, который подходит обоим и имеет продолжительность duration. Если нет общего временного слота, который удовлетворяет требованиям, верните пустой массив. Формат временного слота — это массив из двух элементов [start, end], представляющий инклюзивный временной диапазон от start до end. Гарантируется, что никакие два доступных временных слота одного и того же человека не пересекаются друг с другом. То есть для любых двух временных слотов [start1, end1] и [start2, end2] одного и того же человека либо start1 > end2, либо start2 > end1. Пример: Input: slots1 = [[10,50],[60,120],[140,210]], slots2 = [[0,15],[60,70]], duration = 8 Output: [60,68] 👨💻 Алгоритм: 1⃣Отсортируйте оба массива slots1 и slots2 по времени начала. 2⃣Инициализируйте два указателя, указывающие на начало slots1 и slots2 соответственно. 3⃣Перебирайте, пока указатель1 не достигнет конца slots1 или указатель2 не достигнет конца slots2: Найдите общий слот между slots1[pointer1] и slots2[pointer2]. Если общий слот больше или равен duration, верните результат. В противном случае найдите слот, который заканчивается раньше, и передвиньте указатель. Если общий слот не найден, верните пустой массив. 😎 Решение: class Solution { fun minAvailableDuration(slots1: Array, slots2: Array, duration: Int): List { slots1.sortBy { it[0] } slots2.sortBy { it[0] } var pointer1 = 0 var pointer2 = 0 while (pointer1 < slots1.size && pointer2 < slots2.size) { val intersectLeft = maxOf(slots1[pointer1][0], slots2[pointer2][0]) val intersectRight = minOf(slots1[pointer1][1], slots2[pointer2][1]) if (intersectRight - intersectLeft >= duration) { return listOf(intersectLeft, intersectLeft + duration) } if (slots1[pointer1][1] < slots2[pointer2][1]) { pointer1++ } else { pointer2++ } } return emptyList() } } Ставь 👍 и забирай 📚 Базу знаний
Kotlin | LeetCode
FAQ

Open Kotlin | LeetCode in Telegram and press the Start button. No separate registration is required.

Yes. The service is designed to be straightforward: open the resource, follow the on-screen instructions and start using it.

No. You can use Kotlin | LeetCode directly in Telegram unless the resource description says otherwise.

Access depends on the resource. Check the current information in Telegram after opening Kotlin | LeetCode.

The exact features depend on the resource. Open Kotlin | LeetCode to see its current functions, content and access conditions.

Reviews for channel Kotlin | LeetCode

Log in to leave a review

Only registered users can share their opinion.

No reviews yet

Be the first to share your impression of this resource!

Similar resources

Loading
Switch to Light Theme
Home Catalog Collections Blog Login