Coding Interview Resources
This channel contains the free resources and solution of coding problems which are usually asked in the interviews. Managed by: @love_data
Ko'proq ko'rsatish๐ Telegram kanali Coding Interview Resources analitikasi
Coding Interview Resources (@crackingthecodinginterview) Ingliz til segmentidagi kanali faol ishtirokchi. Hozirda hamjamiyat 52 116 obunachidan iborat bo'lib, Texnologiyalar & Aralashmalar toifasida 2 569-o'rinni va Hindiston mintaqasida 7 298-o'rinni egallagan.
๐ Auditoriya koโrsatkichlari va dinamika
ะฝะตะฒัะดะพะผะพ sanasidan buyon loyiha tez oโsib, 52 116 obunachiga ega boโldi.
03 Iyun, 2026 dagi oxirgi maโlumotlarga koโra kanal barqaror faollikka ega. Oxirgi 30 kunda obunachilar soni 184 ga, soโnggi 24 soatda esa 20 ga oโzgardi va umumiy qamrov yuqori darajada qolmoqda.
- Tasdiqlash holati: Tasdiqlanmagan
- Jalb etish (ER): Auditoriya oโrtacha 1.82% darajada jalb etiladi. Nashrdan keyingi dastlabki 24 soatda kontent odatda umumiy obunachilar sonining 0.83% ini tashkil etuvchi reaksiyalarni toโplaydi.
- Post qamrovi: Har bir post oโrtacha 947 marta koโriladi; birinchi sutkada odatda 432 ta koโrish yigโiladi.
- Reaksiyalar va oโzaro taโsir: Auditoriya faol: har bir postga oโrtacha 2 ta reaksiya keladi.
- Tematik yoโnalishlar: Kontent array, stack, algorithm, programming, sort kabi asosiy mavzularga jamlangan.
๐ Tavsif va kontent siyosati
Muallif resursni shaxsiy fikrni ifoda etish maydoni sifatida taโriflaydi:
โThis channel contains the free resources and solution of coding problems which are usually asked in the interviews.
Managed by: @love_dataโ
Yuqori yangilanish chastotasi (oxirgi maโlumot 04 Iyun, 2026 da olingan) sababli kanal doimo dolzarb va katta qamrovli boโlib qoladi. Analitika auditoriya kontent bilan faol hamkorlik qilishini, uni Texnologiyalar & Aralashmalar toifasidagi muhim taโsir nuqtasiga aylantirishini koโrsatadi.
heapq.heappush(heap, (node.val, node))
Repeatedly:
โข Pop smallest node
โข Add next node from same list
๐น Complexity
Complexity - Value
Time - O(n log k)
Space - O(k)
Where:
n = total nodes
k = number of lists
๐น Interview Tip
Very common hard interview problem.
๐ 38. How do you implement LRU / LFU cache?
๐น LRU Cache
LRU: Least Recently Used
Remove least recently accessed item.
๐น Efficient Design
Use:
1. HashMap
2. Doubly Linked List
๐น Python LRU Example
from collections import OrderedDict
class LRUCache:
def __init__(self, capacity):
self.cache = OrderedDict()
self.capacity = capacity
def get(self, key):
if key not in self.cache:
return -1
self.cache.move_to_end(key)
return self.cache[key]
def put(self, key, value):
if key in self.cache:
self.cache.move_to_end(key)
self.cache[key] = value
if len(self.cache) > self.capacity:
self.cache.popitem(last=False)
๐น Complexity
Operation - Complexity
Get - O(1)
Put - O(1)
๐น Interview Tip
LRU cache is a FAANG-favorite system design question.
๐ 39. How do you check for balanced parentheses?
Use a stack.
๐น Idea
โข Push opening brackets.
โข When closing bracket appears: Check top of stack
๐น Python Solution
def is_valid(s):
stack = []
mapping = {
')': '(',
'}': '{',
']': '['
}
for char in s:
if char in mapping.values():
stack.append(char)
elif char in mapping:
if not stack or stack.pop() != mapping[char]:
return False
return not stack
print(is_valid("({[]})"))
๐น Output
True
๐น Complexity
Complexity - Value
Time - O(n)
Space - O(n)
๐น Uses
โ
Compilers
โ
Expression parsing
โ
Syntax validation
๐ 40. How do you implement a circular queue?
Circular queue reuses empty spaces efficiently.
๐น Visualization
Front โ [1,2,3,_,_]
After dequeue + enqueue:
[,2,3,4,]
๐น Python Implementation
class CircularQueue:
def __init__(self, size):
self.queue = [None] * size
self.front = 0
self.rear = 0
self.size = size
self.count = 0
def enqueue(self, value):
if self.count == self.size:
return "Full"
self.queue[self.rear] = value
self.rear = (self.rear + 1) % self.size
self.count += 1
def dequeue(self):
if self.count == 0:
return "Empty"
value = self.queue[self.front]
self.front = (self.front + 1) % self.size
self.count -= 1
return value
๐น Complexity
Operation - Complexity
Enqueue - O(1)
Dequeue - O(1)
๐น Real-World Uses
โ
CPU scheduling
โ
Streaming systems
โ
Buffers
โ
Embedded systems
๐ฅ Double Tap โค๏ธ For Part-5class MaxStack:
def __init__(self):
self.stack = []
self.max_stack = []
def push(self, value):
self.stack.append(value)
if not self.max_stack or value >= self.max_stack[-1]:
self.max_stack.append(value)
def pop(self):
if self.stack[-1] == self.max_stack[-1]:
self.max_stack.pop()
return self.stack.pop()
def get_max(self):
return self.max_stack[-1]
๐น Complexity
Operation - Complexity
Push - O(1)
Pop - O(1)
Get Max - O(1)
๐น Interview Tip
Very common design-based stack question.
๐ 32. How do you implement a queue using two stacks?
Queues are FIFO. Stacks are LIFO.
We can combine two stacks.
๐น Idea
Stack1 โ enqueue
Stack2 โ dequeue
๐น Python Solution
class Queue:
def __init__(self):
self.s1 = []
self.s2 = []
def enqueue(self, value):
self.s1.append(value)
def dequeue(self):
if not self.s2:
while self.s1:
self.s2.append(self.s1.pop())
return self.s2.pop()
๐น Complexity
Operation - Complexity
Enqueue - O(1)
Dequeue - Amortized O(1)
๐น Interview Tip
Interviewers love this because it tests understanding of stack behavior.
๐ 33. How do you design a stack that supports getMin() in O(1)?
Very similar to Max Stack.
๐น Idea
Maintain:
โข Main stack
โข Min stack
๐น Python Solution
class MinStack:
def __init__(self):
self.stack = []
self.min_stack = []
def push(self, value):
self.stack.append(value)
if not self.min_stack or value <= self.min_stack[-1]:
self.min_stack.append(value)
def pop(self):
if self.stack[-1] == self.min_stack[-1]:
self.min_stack.pop()
return self.stack.pop()
def get_min(self):
return self.min_stack[-1]
๐น Complexity
Operation - Complexity
Push - O(1)
Pop - O(1)
Get Min - O(1)
๐น Interview Tip
This is one of the highest-frequency interview problems.
๐ 34. What is a monotonic stack and when is it useful?
A monotonic stack maintains elements in:
โข Increasing order OR
โข Decreasing order
๐น Uses
โ
Next Greater Element
โ
Largest Rectangle in Histogram
โ
Stock Span Problem
โ
Daily Temperatures
๐น Example
arr = [2, 1, 3]
stack = []
for num in arr:
while stack and stack[-1] > num:
stack.pop()
stack.append(num)
๐น Complexity
Most monotonic stack problems:
O(n)
because every element is pushed and popped once.
๐น Interview Tip
Extremely important pattern for medium/hard problems.
๐ 35. How do you implement a priority queue / heap?
A heap is a complete binary tree.
Types:
โข Min Heap
โข Max Heap
๐น Python Min Heap
import heapq
heap = []
heapq.heappush(heap, 10)
heapq.heappush(heap, 5)
heapq.heappush(heap, 20)
print(heapq.heappop(heap))
๐น Output
5
๐น Complexity
Operation - Complexity
Insert - O(log n)
Delete - O(log n)
Peek - O(1)
๐น Uses
โ
Task scheduling
โ
Dijkstraโs algorithm
โ
Top K problems
โ
Priority processing
๐ 36. How do you find the top K frequent elements?
๐น Approach
1. Count frequency using hashmap
2. Use heap
๐น Python Solution
from collections import Counter
import heapq
def top_k(nums, k):
freq = Counter(nums)
return heapq.nlargest(k, freq.keys(), key=freq.get)
print(top_k([1, 1, 1, 2, 2, 3], 2))
๐น Output
[1, 2]
๐น Complexity
Complexity - Value
Time - O(n log k)
Space - O(n)
๐น Interview Tip
Heap + hashmap combination is frequently tested.
๐ 37. How do you merge K sorted lists?
๐น Efficient Approach
Use a Min Heap.
Heap stores:
smallest current node
๐น Python Idea
import heapqclass Node:
def __init__(self, data):
self.data = data
self.next = None
def reverse(head):
prev = None
current = head
while current:
next_node = current.next
current.next = prev
prev = current
current = next_node
return prev
๐น Complexity
Time โ O(n)
Space โ O(1)
๐น Interview Tip
This is one of the most important linked-list questions.
๐ 22. How do you detect a cycle in a linked list?
Use Floydโs Cycle Detection Algorithm.
Also called: Tortoise and Hare Algorithm
๐น Idea
โข Slow pointer moves 1 step
โข Fast pointer moves 2 steps
โข If they meet โ cycle exists
๐น Python Solution
def has_cycle(head):
slow = fast = head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
if slow == fast:
return True
return False
๐น Complexity
Time โ O(n)
Space โ O(1)
๐น Interview Tip
Very common interview question.
๐ 23. How do you find the middle node of a linked list?
Use two pointers.
๐น Approach
โข Slow pointer โ moves 1 step
โข Fast pointer โ moves 2 steps
When fast reaches end:
slow = middle
๐น Python Solution
def middle_node(head):
slow = fast = head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
return slow
๐น Complexity
Time โ O(n)
Space โ O(1)
๐น Interview Tip
Two-pointer technique is heavily used in linked lists.
๐ 24. How do you merge two sorted linked lists?
๐น Example
1 โ 3 โ 5
2 โ 4 โ 6
Merged:
1 โ 2 โ 3 โ 4 โ 5 โ 6
๐น Python Solution
def merge_lists(l1, l2):
dummy = Node(0)
current = dummy
while l1 and l2:
if l1.data < l2.data:
current.next = l1
l1 = l1.next
else:
current.next = l2
l2 = l2.next
current = current.next
current.next = l1 or l2
return dummy.next
๐น Complexity
Time โ O(n + m)
Space โ O(1)
๐น Interview Tip
This problem is the base concept behind merge sort on linked lists.
๐ 25. How do you find and remove a duplicate in a list?
๐น Using HashSet
def remove_duplicates(head):
seen = set()
current = head
prev = None
while current:
if current.data in seen:
prev.next = current.next
else:
seen.add(current.data)
prev = current
current = current.next
return head
๐น Complexity
Time โ O(n)
Space โ O(n)
๐น Without Extra Space
Can also be solved using nested loops: O(nยฒ)
๐น Interview Tip
Interviewers may ask: Can you solve it without extra memory?
๐ 26. How do you implement a dummy head in linked-list problems?
A dummy node simplifies edge cases.
๐น Why Useful?
Without dummy node: Handling head insertion/deletion becomes complex
With dummy node: Logic becomes cleaner
๐น Example
dummy = Node(0)
dummy.next = head
๐น Use Cases
โ
Remove nodes
โ
Merge lists
โ
Partition lists
โ
Reverse sublists
๐น Interview Tip
Using dummy nodes often makes solutions cleaner and bug-free.
๐ 27. How do you delete a node given only that node (no head)?
Important constraint: No access to head pointer
๐น Trick
Copy next node value into current node.
๐น Python Solution
def delete_node(node):
node.data = node.next.data
node.next = node.next.next
๐น Limitation
Cannot delete last node because no next node exists.
๐น Interview Tip
Classic interview trick question.
๐ 28. How do you implement a circular linked list?
In a circular linked list: Last node โ points to head instead of NULL.
๐น Visualization
1 โ 2 โ 3
โ โ
โ โ โ โ
๐น Python Example
class Node:
def init(self, data):
self.data = data
self.next = None
Endi mavjud! Telegram Tadqiqoti 2025 โ yilning asosiy insaytlari 
