Logo
TGCATALOG
Catalog Collections Blog
Golang | LeetCode

Golang | LeetCode

LeetCode tasks in Golang. Solutions with code and explanations.

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

LeetCode tasks in Golang. Solutions with code and explanations.

Подписчиков —
Тематика Technology
Ссылка @easy_golang_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

Channel with solutions to popular LeetCode tasks in Go. Focus on optimized algorithms, efficient memory usage, and idiomatic code. Helps prepare for technical interviews in companies that use Golang.

Latest posts

Golang | LeetCode
Golang | LeetCode
🔒Открыть пост
и посмотреть медиа
Задача: 1275. Find Winner on a Tic Tac Toe Game Сложность: easy В игру "Крестики-нолики" играют два игрока A и B на сетке 3 x 3. Правила игры "Крестики-нолики" таковы: игроки по очереди помещают символы в пустые квадраты ' '. Первый игрок A всегда помещает символы "X", а второй игрок B - "O". Символы "X" и "O" всегда помещаются в пустые квадраты, а не в заполненные. Игра заканчивается, когда три одинаковых (непустых) символа заполняют любую строку, столбец или диагональ. Игра также заканчивается, если все клетки непустые. Больше ходов не может быть сыграно, если игра закончена. Учитывая двумерный целочисленный массив moves, где moves[i] = [rowi, coli] указывает, что i-й ход будет сыгран на сетке[rowi][coli]. верните победителя игры, если он существует (A или B). Если игра закончилась вничью, верните "Ничья". Если еще есть ходы для игры, верните "Pending". Можно предположить, что ходы действительны (т.е. соответствуют правилам игры в Крестики-нолики), сетка изначально пуста, и A будет играть первым. Пример: Input: moves = [[0,0],[2,0],[1,1],[2,1],[2,2]] Output: "A" 👨💻 Алгоритм: 1⃣Инициализируйте пустую 3x3 сетку. 2⃣Пройдите по списку ходов и обновите сетку в соответствии с ходами игроков A и B. 3⃣После каждого хода проверяйте, есть ли победитель. Если все ходы сделаны и нет победителя, проверьте, завершена ли игра вничью или еще есть ходы. 😎 Решение: func tictactoe(moves [][]int) string {     grid := [3][3]byte{}     for i, move := range moves {         if i%2 == 0 {             grid[move[0]][move[1]] = 'X'         } else {             grid[move[0]][move[1]] = 'O'         }     }     for i := 0; i < 3; i++ {         if grid[i][0] == grid[i][1] && grid[i][1] == grid[i][2] && grid[i][0] != 0 {             if grid[i][0] == 'X' {                 return "A"             } else {                 return "B"             }         }         if grid[0][i] == grid[1][i] && grid[1][i] == grid[2][i] && grid[0][i] != 0 {             if grid[0][i] == 'X' {                 return "A"             } else {                 return "B"             }         }     }     if grid[0][0] == grid[1][1] && grid[1][1] == grid[2][2] && grid[0][0] != 0 {         if grid[0][0] == 'X' {             return "A"         } else {             return "B"         }     }     if grid[0][2] == grid[1][1] && grid[1][1] == grid[2][0] && grid[0][2] != 0 {         if grid[0][2] == 'X' {             return "A"         } else {             return "B"         }     }     if len(moves) == 9 {         return "Draw"     }     return "Pending" } Ставь 👍 и забирай 📚 Базу знаний
Golang | LeetCode
FAQ

Open Golang | 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 Golang | LeetCode directly in Telegram unless the resource description says otherwise.

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

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

Reviews for channel Golang | 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