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
πŸ‘5
πŸ˜…πŸ€£
😁40🀣16πŸ”₯1🌚1
πŸ”₯9
πŸ‡¬πŸ‡§ Summary

Hi, guys! Let me summarize what we covered so far and share the links to the posts, so that it would be easier to navigate.

1. 3 types of binary tree traversal.
2. Recursion. Theory.
3. Breaking the [bad] habit. Triggers.
4. Data Structure: Array.
5. Hashtable in Java. Inside out.
6. Data Structure: Linked list.
7. Data Structures: Stack and Queue.
8. Sorting Algorithms.

Also, I want to share some numbers:

- 1 300++ followers of this channel so far.
- 620++ Problems solved so far.
- 32 000++ my rank on LeetCode.
- 130 000+ views of my solutions.
- 187 days of solving problems without missing a single day.

Yeah! Thanks for reading this blog!
Keep moving forward!
πŸ”₯8
πŸ‡ΊπŸ‡Ώ Summary

Hammaga salom! Bu postda men yozilgan mavzularga havolalarni qoldirmoqchiman. Maqsad - mavzularni tez topa olish.

1. Binar daraxtni aylanib o'tishning 3 xili.
2. Rekursiya. Nazariya.
3. Breaking the [bad] habit. Triggerlar.
4. Ma'lumotlar tuzilmasi: Massiv.
5. Java-da Hashtable. To'liq tahlil.
6. Ma'lumotlar tuzilmasi: Linked list.
7. Ma'lumotlar tuzilmasi: Stack va Queue.
8. Saralash algoritmlari.

Siz bilan yana bu kanalga va LeetCode-ga oid raqamlar bilan bo'lishmoqchiman:

- 1 300++ kanal obunachilar soni.
- 620++ yechilgan masalalar soni.
- 32 000++ LeetCode-da mening rank-im.
- 130 000++ marta men post qilgan yechimlarni LeetCode-da ko'rishgan ekan.
- 187 kun davomida bir kun ham o'tkazmay masalalar yechgan ekanman.

Ha! Shu blogni o'qib borayotganingiz uchun rahmat!
Olg'a!
πŸ”₯33πŸ‘4❀1
LeetCodin pinned Β«πŸ‡¬πŸ‡§ Summary Hi, guys! Let me summarize what we covered so far and share the links to the posts, so that it would be easier to navigate. 1. 3 types of binary tree traversal. 2. Recursion. Theory. 3. Breaking the [bad] habit. Triggers. 4. Data Structure: Array.…»
LeetCodin pinned Β«πŸ‡ΊπŸ‡Ώ Summary Hammaga salom! Bu postda men yozilgan mavzularga havolalarni qoldirmoqchiman. Maqsad - mavzularni tez topa olish. 1. Binar daraxtni aylanib o'tishning 3 xili. 2. Rekursiya. Nazariya. 3. Breaking the [bad] habit. Triggerlar. 4. Ma'lumotlar tuzilmasi:…»
πŸ˜…πŸ€£
🀣60😁4πŸ‘1
πŸ‡¬πŸ‡§ 268. Missing Number. Using XOR.

🟒 Easy: 268. Missing Number
πŸ‘¨β€πŸ’» Solution: Easiest Bit Manipulation

Hi! Today I'll check one more possible solution for Missing number problem. This solution I took from leetcoder with username drat. Go and hit the "upvote" button if you like his solution.

πŸ‘¨β€πŸ’» Task
You are given unsorted numbers from 0 to n, where one number out of this range is missing. You should return the missing one.

πŸ’‘ Idea
Solution is based on the following:
If you apply XOR to equal numbers, then you get 0. In other words, if you apply XOR to a number and 0, then you'll get that number.

πŸ‘¨β€πŸ’» Solution
1. You declare int variable ans and assign 0 to it.
2. Then you loop thru all elements of given array and do the following: ans = ans ^ i ^ nums[i]. Here we have associative property applied. It means that rearranging elements in sum will not change the result. Wikipedia.
3. Finally, he applies XOR to ans and the length of nums. Thus, we will get the missing number.

Example 1: nums = {0,3,2}
1. When XOR applied to all elements: 0 ^ 0 ^ 3 ^ 1 ^ 2 ^ 2. So, ans will be equal to 3 ^ 1.
2. Length of the array is 3. ans ^ nums.length = (3 ^ 1) ^ 3 = (3 ^ 3) ^ 1 = 0 ^ 1 = 1.
Thus, the answer is 1.

Example 2: nums = {0,1,2}
1. When XOR applied to all elements: 0 ^ 0 ^ 1 ^ 1 ^ 2 ^ 2 = 0.
2. Length of the array is 3. 0 ^ 3 = 3.
Thus, answer is 3.

This is it.
Good luck! βœŒοΈπŸ€“
πŸ‡ΊπŸ‡Ώ 268. Missing Number. XOR ishlatgan holda yechish.

🟒 Oson: 268. Missing Number
πŸ‘¨β€πŸ’» Yechim: Easiest Bit Manipulation

Salom! Bugun yana bitta mumkin bo'lgan yechimni ko'rib chiqaman. Bu algoritmda XOR bitwise operatsiyasi ishlatiladi. Bu yechimni yozgan leetcoder-ning username-i drat. Tepada drat bratning yechimiga havola qoldirdim. Agar yechim yoqsa, "upvote" bosib, shu odamga sizga yechim foydali bo'lganligini bildiring.

πŸ‘¨β€πŸ’» Vazifa
Sizga 0-dan n-gacha bo'lgan sonlardan iborat massiv berilgan. Shu massivning ichida bitta son yetishmaydi. Siz shu sonni topishingiz lozim.

πŸ’‘ G'oya
Yechim XOR-ning assosiativ va nol xususiyatlariga asoslangan:
Agar XOR ikkita teng sonlarga ishlatilsa, javob 0 bo'ladi.
Agar XOR bitta son va 0-ga ishlatilsa, javob o'sha son bo'ladi.

πŸ‘¨β€πŸ’» Yechim
1. ans o'zgaruvchisini yaratib, unga 0 yozib qo'yasiz.
2. Keyin hamma elementni for loop ishlatgan holda aylanib chiqasiz va har bir element va uning ideksiga quyidagi operatsiyani ishlatasiz: ans = ans ^ i ^ nums[i]. Bu yerda assosiativ xususiyat ishlatiladi. Bu degani elementlar qanday joyda turishidan qat'i nazar, ularni yig'indisi o'zgarmaydi. Wikipedia.
3. Oxirida XOR-ni ans va massivning uzunligiga ishlatasiz. Shu orqali siz natijani topasiz.

Misol 1: nums = {0,3,2}
1. XOR massiv elementlari va indekslari uchun ishlatilganda: 0 ^ 0 ^ 3 ^ 1 ^ 2 ^ 2. Shunda ans 3 ^ 1 ga teng bo'ladi.
2. Massiv uzunligi 3ga teng. ans ^ nums.length = (3 ^ 1) ^ 3 = (3 ^ 3) ^ 1 = 0 ^ 1 = 1.
Javob: 1.

Misol 2: nums = {0,1,2}
1. XOR massiv elementlari va indekslari uchun ishlatilganda: 0 ^ 0 ^ 1 ^ 1 ^ 2 ^ 2 = 0.
2. Massiv uzunligi 3ga teng. 0 ^ 3 = 3.
Javob: 3.

Bugunga shu.
Omad! βœŒοΈπŸ€“
πŸ‘7πŸ”₯1
πŸ‘9
πŸ˜…πŸ€£
😁36πŸ”₯4🀣4🀑2
πŸ˜…πŸ€£
😁14🀣7πŸ€”2πŸ‘€1
πŸ‡¬πŸ‡§ Knowledge sharing.

Hi! Today I want to share a blog which I find interesting. This blog belongs to Farrukh, on of those people who taught me and motivated me to be a software engineer. He is SE based in Germany.

He shares his thoughts on software engineering, his life, and principles.
In his last post he reviewed a book of Martin Kleppmann "Designing Data-Intensive Applications".

Let me/him know if you find the post useful.
Good luck! βœŒοΈπŸ€“

πŸ‡ΊπŸ‡Ώ Bilim ulashish.

Salom! Bugun men o'zim uchun foydali deb bilgan blog bilan bo'lishmoqchiman. Farruh - menga software engineering-ni o'rgatgan va motivatsiya bergan odamdir. Hozirda u Germaniyada yashaydi.

U dasturlash, dasturchining hayoti va prinsiplari haqida o'z fikrlari bilan bo'lishadi. O'zining oxirgi postida u Martin Kleppmanning "Designing Data-Intensive Applications" [Ma'lumot talab qiladigan ilovalarni loyihalash] kitobini ko'rib chiqdi.

Agar siz postni foydali deb topsangiz, comments-da yozing.
Omad! βœŒοΈπŸ€“
πŸ‘5πŸ”₯2🀨1
πŸ‡¬πŸ‡§ Bubble Sort.

Hi! Let's review sorting algorithms and start with bubble sort.

πŸ™ Link to github: BubbleSort
πŸ•™ Time complexity: O (N ^ 2)

πŸ‘¨β€πŸ’» Approach
1. Start at index zero, compare the element with the next one and swap if arr[0] > arr[1]. Now compare arr[1] & arr[2] and swap if arr[1] > arr[2]. Repeat this process until the end of the array. After doing this, the largest element is present at the end. This whole thing is known as a pass. In the first pass, we process array elements from [0,n-1].

2. Repeat step one but process array elements [0, n-2] because the last one, i.e., arr[n-1], is present at its correct position. After this step, the largest two elements are present at the end.

3. Repeat this process n-1 times.

Sources:
1. Bubble sort in C

Good luck! βœŒοΈπŸ€“
πŸ‘6
πŸ‡ΊπŸ‡Ώ Bubble tartiblash usuli.

πŸ™ Github: BubbleSort
πŸ•™ Time complexity: O (N ^ 2)

πŸ‘¨β€πŸ’» Izoh
1. 0 indeksli elementdan boshlaysiz. Shu elementni keyingi element bilan solishtirasiz. Agar arr[0] > arr[1] bo'lsa, joylarini almashirasiz. Endi keyingi indeksga o'tib, arr[1] va arr[2] solishtirasiz. Agar arr[1] > arr[2] bo'lsa, joylarini almashtirasiz. Shu harakatlarni massivning oxirigacha bajarasiz. Natijada, eng katta element massivning oxirgi indeksida joylashgan bo'ladi. Shu jarayon pass deyiladi. Birinchi pass-da, biz 0-dan n-1 indeksli elementlarni tekshirib chiqasiz.

2. Tepadagi harakatlarni qaytarasiz, lekin bu safar faqat 0-dan n-2-gacha indekslarga ega bo'lgan elementlar uchun, chunki oxirgi arr[n-1] element o'z joyida joylashgan. Bu bosqichdan keyin ikkita eng katta element massivning oxirigi ikkita indeks ostida joylashadi.

3. Bu jarayonni n-1 marta qaytarasiz.

Manbalar:
1. Bubble sort in C

Omad! βœŒοΈπŸ€“
πŸ‘7
Code
πŸ‘5
πŸ˜…πŸ€£
😁35🀣15πŸ‘5πŸ‘€1
πŸ‡¬πŸ‡§ Selection Sort.

Hi! Let's continue our journey into sorting algorithms. Today I'll cover selection sort.

πŸ˜‡ Link to Github: Selection sort
⏰ Time complexity: O(N ^ 2)
πŸ”Ž Space complexity: O(1)

πŸ§‘β€πŸ’» Approach πŸ§‘β€πŸ’»
1. 🧐 Find the minimum element in the array and swap it with the element in the 1st position.

2. 🧐 Find the minimum element again in the remaining array[2, n] and swap it with the element at 2nd position, now we have two elements at their correct positions.

3. βœ… We have to do this n-1 times to sort the array.

Sources:
1. Selection sort in C

Good luck! ✌️😎

@leetcodin
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘4