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
🔒Открыть пост
и посмотреть медиа
Задача: 1198. Find Smallest Common Element in All Rows Сложность: medium Дана матрица mat размером m x n, где каждая строка отсортирована в строго возрастающем порядке. Верните наименьший общий элемент во всех строках. Если общего элемента нет, верните -1. Пример: Input: mat = [[1,2,3,4,5],[2,4,5,8,10],[3,5,7,9,11],[1,3,5,7,9]] Output: 5 👨💻 Алгоритм: 1⃣Инициализация переменных: Инициализируйте массив позиций pos, переменную для текущего максимального значения cur_max и счетчик cnt нулями. 2⃣Итерация по строкам матрицы: Для каждой строки: - увеличивайте позицию в строке, пока значение не станет равным или больше текущего максимума. - если достигли конца строки, возвращайте -1. - если значение равно текущему максимуму, увеличивайте счетчик. - в противном случае, сбросьте счетчик до 1 и обновите текущий максимум. 3⃣Проверка счетчика: Если счетчик равен количеству строк, возвращайте текущий максимум. Повторите шаг 2. 😎 Решение: class Solution { fun smallestCommonElement(mat: Array): Int { val n = mat.size val m = mat[0].size val pos = IntArray(n) { 0 } var curMax = 0 var cnt = 0 while (true) { for (i in 0 until n) { while (pos[i] < m && mat[i][pos[i]] < curMax) { pos[i]++ } if (pos[i] >= m) { return -1 } if (mat[i][pos[i]] != curMax) { cnt = 1 curMax = mat[i][pos[i]] } else { cnt++ if (cnt == n) { return curMax } } } } } } Ставь 👍 и забирай 📚 Базу знаний
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