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
🔒Открыть пост
и посмотреть медиа
Задача: 641. Design Circular Deque Сложность: medium Разработайте свою реализацию круговой двусторонней очереди (deque). Реализуйте класс MyCircularDeque: MyCircularDeque(int k) Инициализирует deque с максимальным размером k. boolean insertFront() Добавляет элемент в переднюю часть Deque. Возвращает true, если операция прошла успешно, или false в противном случае. boolean insertLast() Добавляет элемент в заднюю часть Deque. Возвращает true, если операция выполнена успешно, или false в противном случае. boolean deleteFront() Удаляет элемент из передней части Deque. Возвращает true, если операция прошла успешно, или false в противном случае. boolean deleteLast() Удаляет элемент из задней части Deque. Возвращает true, если операция прошла успешно, или false в противном случае. int getFront() Возвращает передний элемент из Deque. Возвращает -1, если Deque пуст. int getRear() Возвращает последний элемент из Deque. Возвращает -1, если Deque пуст. boolean isEmpty() Возвращает true, если Deque пуст, или false в противном случае. boolean isFull() Возвращает true, если Deque полон, или false в противном случае. Пример: Input ["MyCircularDeque", "insertLast", "insertLast", "insertFront", "insertFront", "getRear", "isFull", "deleteLast", "insertFront", "getFront"] [[3], [1], [2], [3], [4], [], [], [], [4], []] Output [null, true, true, true, false, 2, true, true, true, 4] 👨💻 Алгоритм: 1⃣Инициализация и проверка состояний Реализуйте конструктор для инициализации кольцевой двусторонней очереди заданного размера и методы для проверки пустоты и полноты очереди. 2⃣Операции вставки Реализуйте методы вставки элементов в переднюю и заднюю части очереди с учетом кольцевой структуры. 3⃣Операции удаления Реализуйте методы удаления элементов из передней и задней частей очереди с учетом кольцевой структуры и методы для получения переднего и заднего элементов очереди. 😎 Решение: package main type MyCircularDeque struct { deque []int front int rear int size int capacity int } func Constructor(k int) MyCircularDeque { return MyCircularDeque{ deque: make([]int, k), front: 0, rear: 0, size: 0, capacity: k, } } func (this *MyCircularDeque) InsertFront(value int) bool { if this.IsFull() { return false } this.front = (this.front - 1 + this.capacity) % this.capacity this.deque[this.front] = value this.size++ return true } func (this *MyCircularDeque) InsertLast(value int) bool { if this.IsFull() { return false } this.deque[this.rear] = value this.rear = (this.rear + 1) % this.capacity this.size++ return true } func (this *MyCircularDeque) DeleteFront() bool { if this.IsEmpty() { return false } this.front = (this.front + 1) % this.capacity this.size-- return true } func (this *MyCircularDeque) DeleteLast() bool { if this.IsEmpty() { return false } this.rear = (this.rear - 1 + this.capacity) % this.capacity this.size-- return true } func (this *MyCircularDeque) GetFront() int { if this.IsEmpty() { return -1 } return this.deque[this.front] } func (this *MyCircularDeque) GetRear() int { if this.IsEmpty() { return -1 } return this.deque[(this.rear-1+this.capacity)%this.capacity] } func (this *MyCircularDeque) IsEmpty() bool { return this.size == 0 } func (this *MyCircularDeque) IsFull() bool { return this.size == this.capacity } Ставь 👍 и забирай 📚 Базу знаний
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