My pc just makes me so angry
Just I opened Vscode and still now it's not responding.
And still now is on the loading😡, ....whatever now Am trying to use code editor on the online.. However As i open the the software it's closing by it self....😔
There is more conflict b/n the system right?🤔
May be if u have some tips to solve this kind of problem u can tell me✍
Just I opened Vscode and still now it's not responding.
And still now is on the loading😡, ....whatever now Am trying to use code editor on the online.. However As i open the the software it's closing by it self....😔
There is more conflict b/n the system right?🤔
May be if u have some tips to solve this kind of problem u can tell me✍
How are u all guys: here I'm using this resources, and also for more clarification I watch youtube tutorial.👉🏽 https://www.geeksforgeeks.org/dsa/python-data-structures-and-algorithms/
GeeksforGeeks
%%title%% - GeeksforGeeks
Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.
SamiTech Code
Problem: 👉 Given an integer array, find two elements whose sum is closest to 0. arr = [1, -3, 2, -1, 4] Key points: Array may have negative and positive numbers, We want the minimum absolute sum, Use Two Pointer after sorting. …
Sorry for my late my pc was stucked, cuz of that, I didn't share for u what I'm learning. However, here answer for the yesterday night questions.
SamiTech Code
Photo
Questions: What're the following statement line doing👇 1.closest_sum = float('inf') #what happens if we remove #inf 2. pair = (None, None) 3. if abs(current_sum) < abs(closest_sum) 4. pair = (arr[left], arr[right]) Take u'r time & Try to think of it🤔 understanding this concept takes u to the next step💪🏻 AND YOUR ANSWER IN THE COMMENT SECTION👌
https://youtu.be/jzZsG8n2R9A?si=7UX5aOjZpRTpsWGO
Three Sum: u can watch this video to understand how to implement Three SumYouTube
3Sum - Leetcode 15 - Python
🚀 https://neetcode.io/ - A better way to prepare for Coding Interviews
🧑💼 LinkedIn: https://www.linkedin.com/in/navdeep-singh-3aaa14161/
🥷 Discord: https://discord.gg/ddjKRXPqtk
🐦 Twitter: https://twitter.com/neetcode1
🐮 Support the channel: https://w…
🧑💼 LinkedIn: https://www.linkedin.com/in/navdeep-singh-3aaa14161/
🥷 Discord: https://discord.gg/ddjKRXPqtk
🐦 Twitter: https://twitter.com/neetcode1
🐮 Support the channel: https://w…
SamiTech Code pinned «Thinking Problem (Two Pointer – Human Way): You're given this sorted array: [2, 3, 5, 7, 11, 15], target sum = 10 …»
SamiTech Code pinned «Questions: What're the following statement line doing👇 1.closest_sum = float('inf') #what happens if we remove #inf …»
👍1
THREE SUM: What is 3-Sum? 3-Sum = Fix one number + solve 2-Sum on the rest. We've already know 2-Sum with two pointers. So 3-Sum is just reusing that skill. Step-by-Step thinking (Human way): Step 1: Sort the array why? Enables two pointer makes duplicate skipping easy Step 2: Fix one number(loop) imagine you say: "Let me lock this number, and find two others that cancel it." if the fixed number is x, then; we need two numbers with sum = -x Step 3: Apply Two pointer for the remaining part —left pointer > next index after fixed —right pointer > end of array Now this becomes a 2-Sum problem. In the next, I'll share the Visual Example to understand clearly.👇👇
👍1🌚1
Visual Example with best clarifications: Read the👇👇👇You understand clearly about 3-Sum in easy way👌
I HOPE YOU UNDERSTAND THE LOGIC OF 3-SUM😄
Array: [-4, -1, 0, 1, 3, 5] #already sorted(ordered) Step 1: Fix the number -4 😎Fix means take as a constant - 4 or u can say freeze -4,Don't move it 👉🏽3-Sum goal is: a + b + c = 0 substitute -4 =a: -4 + b + c = 0 => b + c = 4 :) Target for the remaining two numbers sum = 4 Step 2: Choose where b and c can come from: We mustn't reuse -4 , so we search to the right👇 [-4 | -1, 0, 1, 3, 5]
↑ ↑ ↑ ↑ ↑ now pointer is doing this: left = -1, right = 5. then -1 + 5 = 4✅ :- b = -1 & c = 5 Step 4: Build the triplet: and don't forget the fixed number😀-4 => -4 + (-1) + 5 = 0 👏 Valid triplet found: (-4, -1, 5) Step 5: What happen next? After then finding a valid pair: -move both pointer: means the left to the right and the right to the left at the same time. & If there's duplicate skip New pointers: left = 0, right = 3. 0 + 3 !=4(target value). So since Sum < target move the left to the right. 1 + 3 = 4 👏Again a valid triplet found: (-4, 1, 3) keep in mind: if left and right crossed each others stop the condition. (left = 3 then right = 1)CROSSED CONDITIONS⚠️ FINAL RESULT FOR FIXED -4 Valid triplet: (-4, -1, 5) & (-4, 1, 3) Generally: 3-Sum = Freeze one number → solve a 2-sum problem beside it.
I HOPE YOU UNDERSTAND THE LOGIC OF 3-SUM😄
Implementation of 3-Sum:
👉🏽the algorithm said hey, for 0, 1, 3, 5 I don't have any idea, since these haven't valid triplet, so I don't talk about the😁
Don't forget about two pointer👌 In simple the program is talks about fixing (keep constant each elements if it's true and find sum of other two values that equal to target. Therefore, fixed value -4 and -1. here algorithm say this's VALID TRIPLET but for others since they're not equal to their target value.
👉🏽the algorithm said hey, for 0, 1, 3, 5 I don't have any idea, since these haven't valid triplet, so I don't talk about the😁
Guys I hate class😏
Just we went to class but no teacher.
He said am coming but nothing happend we waited him about 30 minute.
Now am in my dorm.
..what do u think🤔
Just we went to class but no teacher.
He said am coming but nothing happend we waited him about 30 minute.
Now am in my dorm.
..what do u think🤔
if he said now I'm in class but there's no anyone. I need all of u to back to class early😔
😢1
4️⃣ SUM: On Loading... That's similar with 3️⃣ SUM. Just only on small d/c.🕒
Keep point: 4️⃣ SUM Four Sum = Fix two numbers + solve two-Sum with two pointers. a + b + c + d = target This's only new idea but the other is as it's.