LeetCodin
1.4K subscribers
160 photos
3 videos
2 files
303 links
LeetCode 1700+
🇺🇿🇺🇸
Motto: Победа любит подготовку

- Getting ready for FAANG | FAANGga tayyorlanamiz
- Data Structures and Algorithms | Ma'lumotlar tuzilmalari va Algoritmlar
- SWE at Deloitte 🇺🇸
- LeetCode: https://leetcode.com/tbekpro/
Download Telegram
🇺🇿O'zbek tilida

Hammaga salom! Bugun yakshanba, tashqarida yomg'ir yog'moqda. Oldingi mavzulardan birini tiklaymiz: DFS rekursiv aylanib o'tish. Men bunday muammolarni yechish uchun foydalanadigan asosiy yondashuvni bergan edim [link] va siz uni quyidagi muammoga osongina qo'llashingiz mumkin. Keling buni bajaramiz!

Masala: 112. Path Sum
Mening yechimim: Solution

Natijalaringizni bilan bo'lishing - kimning yechimi tezroq ekanligini ko'raylik😁
🔥9👍4
🇬🇧Binary Tree: Inorder Traversal

🇺🇿O'zbekchasi pastda⬇️

Hi, guys! Thanks for your answers to the poll I shared yesterday. It's obvious that all data structures need to be overviewed and we will start from Binary Tree since it was the top choice.

I hope that one day we will fully review this data structure online later. Today I want to draw your attention to Inorder Traversal of Binary Tree.

Basic idea of inorder traversal is:
1. Go to the left node (subtree)
2. Then go to the parent
3. Then go to the right node (subtree).

Let's pause here. Try to solve the problem on LeetCode just knowing the information above: 94. Binary Tree Inorder Traversal
Hint: try to use recursive method.

OK. I hope you were able to solve it. Here is more information on inorder traversal:
1. Article about inorder traversing

2. My solution on LeetCode.

I'll add animated image to demonstrate how a binary tree should be traversed.
👍4🔥3
🇺🇿 Binary Tree: Inorder Traversal (Inorder aylanib o'tish usuli)

Hammaga salom! Kecha so'rovnomaga bergan javoblaringiz uchun rahmat. Ko'rinib turibdiki, barcha ma'lumotlar tuzilmalari ko'rib chiqilishi kerak va biz Binary Tree-dan boshlaymiz, chunki bu top tanlov edi.

Umid qilamanki, bir kun biz ushbu ma'lumotlar tuzilmasini onlayn tarzda to'liq ko'rib chiqamiz, chunki buning uchun men avval yaxshilab tayyorlanishim kerak. Bugun esa men sizning e'tiboringizni Ikki tugunli (Binary Tree) daraxtning Inorder aylanib o'tish usuliga qaratmoqchiman.

Inorder usuli bilan daraxtni kesib o'tishning asosiy g'oyasi:
1. Chap tugunga o'ting (chap bola daraxt)
2. Keyin ona tugunga [parent node] boring
3. Keyin o'ng tugunga (o'ng bola daraxt) o'ting.
[Agar noto'g'ri tarjima qilgan bo'lsam, iltimos, comment qilib yozib yuboring🙈]

Keling, shu yerda to'xtab, yuqoridagi ma'lumotlarni bilib turib, LeetCode-dagi masalani yechishga harakat qilamiz: 94. Ikkilik daraxtning inorder tartibida o'tish
Maslahat: rekursiv usuldan foydalanib ko'ring.

OK. Umid qilamanki, siz masalani yecha oldingiz. Bu Inorder kesib o'tish haqida ko'proq ma'lumot:
1. Inorder tartibida kesib o'tish haqida maqola

2. LeetCode-da mening yechimim

Inorder aylanib o'tishni ko'rsatish uchun shu postni tagiga animatsiya qilingan rasm ham qo'yaman.
👍8
🇬🇧Binary Tree: Postorder Traversal

🇺🇿O'zbekchasi pastda⬇️

Hi, guys! Today we will have another post on Binary Tree traversal - Postorder Traversal.

Basic idea of postorder traversal is:
1. Go to the left node (subtree).
2. Then go to the right node (subtree).
3. Then go to the parent.

Let's pause here. Try to solve the problem on LeetCode just knowing the information above: 145. Binary Tree Postorder Traversal
Hint: try to use recursive method.

OK. I hope you were able to solve it. Here is more information on postorder traversal:
1. Article about postorder traversing

2. My solution on LeetCode.

I'll add animated image to demonstrate how a binary tree should be traversed.
🔥4👍1
🇺🇿 Binar daraxtni Postorder usuli bilan aylanib o'tish
(Binary Tree: Postorder Traversal)

Hammaga salom! Bugun Binar daraxtni (binary tree) ni aylanib o'tishning Postorder usulini ko'rib chiqamiz.

Postorder usuli bilan daraxtni kesib o'tishning asosiy g'oyasi:
1. Chap tugunga o'ting (chap bola daraxt).
2. Keyin o'ng tugunga (o'ng bola daraxt) o'ting.
3. Keyin ona tugunga [parent node] boring.
[Agar noto'g'ri tarjima qilgan bo'lsam, iltimos, comment qilib yozib yuboring🙈]

Keling, shu yerda to'xtab, yuqoridagi ma'lumotlarni bilib turib, LeetCode-dagi masalani yechishga harakat qilamiz: 145. Binary Tree Postorder Traversal
Maslahat: rekursiv usuldan foydalanib ko'ring.

OK. Umid qilamanki, siz masalani yecha oldingiz. Bu yerda esa Postorder kesib o'tish usuli haqida ko'proq ma'lumot:
1. Postorder kesib o'tish haqida maqola

2. LeetCode-da mening yechimim

Postorder aylanib o'tishni ko'rsatish uchun shu postni tagiga animatsiya qilingan rasm ham qo'yaman.
👍4
🇬🇧Binary Tree: Preorder Traversal

🇺🇿O'zbekchasi pastda⬇️

Hi, guys! Today we will have another post on Binary Tree traversal - Preorder Traversal.

Basic idea of preorder traversal is:
1. Go to the parent.
2. Then go to the left node (subtree).
3. Then go to the right node (subtree).

Let's pause here. Try to solve the problem on LeetCode just knowing the information above: 144. Binary Tree Preorder Traversal
Hint: try to use recursive method.

OK. I hope you were able to solve it. Here is more information on preorder traversal:
1. Article about preorder traversing

2. My solution on LeetCode.

I'll add animated image to demonstrate how a binary tree should be traversed.
👍4
🇺🇿 Binar daraxtni Preorder usuli bilan aylanib o'tish
(Binary Tree: Preorder Traversal)

Hammaga salom! Bugun Binar daraxtni (binary tree) ni aylanib o'tishning Preorder usulini ko'rib chiqamiz.

Preorder usuli bilan daraxtni kesib o'tishning asosiy g'oyasi:
1. Ona tugunga o'ting [parent node]
1. Keyin chap tugunga o'ting (chap bola daraxt).
2. Keyin esa o'ng tugunga (o'ng bola daraxt) o'ting.

Keling, shu yerda to'xtab, yuqoridagi ma'lumotlarni bilib turib, LeetCode-dagi masalani yechishga harakat qilamiz: 144. Binary Tree Preorder Traversal
Maslahat: rekursiv usuldan foydalanib ko'ring.

OK. Umid qilamanki, siz masalani yecha oldingiz. Bu yerda esa Preorder kesib o'tish usuli haqida ko'proq ma'lumot:
1. Preorder kesib o'tish haqida maqola.

2. LeetCode-da mening yechimim.

Preorder aylanib o'tishni ko'rsatish uchun shu postni tagiga animatsiya qilingan rasm ham qo'yaman.
🔥2⚡1
🇬🇧Just wanted to share that two milestones were achieved this week:
1. My LeetCode rank reached a 5 digit number
2. Numbers of my solutions’ views exceeded 10 000.

🇺🇿Ikkita kichkina bosqichdan o’tganimni shu yerda bo’lishmoqchiman:
1. Mening LeetCode rankim 5 raqamli son bo’ldi.
2. LeetCode dagi mening yechimlarimni 10 000 marta ko’rishibdi.

Yay!🤩🥳🙌
🎉23🤩4👍2🔥1🏆1🍾1
🇬🇧Binary Tree: Solving problems

🇺🇿O'zbekchasi pastda⬇️

Hi, guys! Let's solve some problems regarding binary trees and what we covered in previous topics. So far we learnt how to traverse binary trees.

I've prepared two problems: one is easy and another is medium level. You can solve the first one by using one of the traversals (inorder, postorder, preorder). However, the second tasks requires you to build a binary tree. This problem might be more difficult, but it's great to challenge yourself and see how can you apply traversal to building a tree. I believe that you can solve it! Let's goooo!🔥🔥🔥

Problem 1 (easy): 700. Search in a Binary Search Tree
My solution: Solution

Problem 2 (medium): 109. Convert Sorted List to Binary Search Tree
My solution: Solution

You can share links to your solutions on LeetCode in the comments
🔥4👍1
🇺🇿 Binar daraxtlar: Masalalar yechamiz

Hammaga salom! Keling, binar daraxtlarga oid ba'zi muammolarni, oldingi ko'rib chiqqan mavzulardan foydalangan holda, yechaylik. Hozirgacha biz binar daraxtlarni qanday kesib o'tishni o'rgandik.

Men ikkita masala tayyorladim: biri oson, ikkinchisi o'rta darajali. Birinchisini kesib o'tish usullardan birini (tartib, keyingi buyurtma, oldindan buyurtma) ishlatib yechsangiz bo'ladi. Biroq, ikkinchi vazifa binar daraxtni qurishni talab qiladi. Bu masala qiyinroq, lekin o'zingizni sinab ko'rish va daraxt qurishda qanday qilib kesib o'tish usulidan foydalanish mumkinligini sinab ko'rishingiz uchun juda ham yaxshi. Men bu muammoni yecha olishingizga ishonaman! Olg'a!🔥🔥🔥

1-masala (oson): 700. Search in a Binary Search Tree
Mening yechimim: Solution

2-masala (qiyinligi medium): 109. Convert Sorted List to Binary Search Tree
Mening yechgan usulim: Solution

Agar yechgan bo'lsangiz, kommentariyda bo'lishing.
👍8
🇬🇧Binary Tree: Solving problems. Part 2

🇺🇿O'zbekchasi pastda⬇️

Hi, guys! It's Saturday! Yahoo!
So, we won't cover new topic today and will try to solve more problems related to binary trees.
These problems are a little bit tricky, but at the same time interesting.

I hope you will enjoy solving them.

Problem 1: 104. Maximum Depth of Binary Tree
My solution: Solution

Problem 2: 606. Construct String from Binary Tree
My solution: Solution

Don't forget to code everyday. Consistency is the key.
Have a good weekend🤜🤛
👍4
Binar daraxt: Masalalar yechamiz. 2-qism

Hammaga salom! Bugun shanba - dam olish kuni! Yahoo!
Shunday qilib, biz bugun yangi mavzuni yoritmaymiz va binar daraxtlar bilan bog'liq ko'proq masalalarni yechishga harakat qilamiz.
Bu masalalar biroz qiyin, lekin shu bilan birga qiziqarli.

Umid qilamanki, siz ularni yechishdan zavqlanasiz.

1-masala: 104. Maximum Depth of Binary Tree
My solution: Solution

Problem 2: 606. Construct String from Binary Tree
My solution: Solution

Har kuni kod yozishni unutmang. Consistency is the key [buni endi tarjima qilishga sal qiynaldim].
Dam olish kuningiz xayrli o'tsin🤜🤛
👍2🔥2