Leetcode with dani
前往频道在 Telegram
Join us and let's tackle leet code questions together: improve your problem-solving skills Preparing for coding interviews learning new algorithms and data structures connect with other coding enthusiasts
显示更多1 259
订阅者
无数据24 小时
+17 天
-730 天
帖子存档
1 259
In my opinion, if you're preparing for an interview and have no enough time left, it’s best not to spend more than 45 minutes on a single problem. Instead, I believe you should focus on understanding different patterns and concepts. This approach can help you become more versatile and better equipped to tackle various questions during the interview. what do you think?
1 259
in my opinion, If you're preparing for an interview and have enough time left, avoid spending more than 45 minutes or on a single problem. Instead, focus on understanding different patterns and concepts. This approach will help you become more versatile and better equipped to tackle various questions during the interview.
1 259
#Q20 #leet_codeQ15 Medium title. 3Sum
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Notice that the solution set must not contain duplicate triplets.
Example 1:
Input: nums = [-1,0,1,2,-1,-4]
Output: [[-1,-1,2],[-1,0,1]]
Explanation:
nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0.
nums[1] + nums[2] + nums[4] = 0 + 1 + (-1) = 0.
nums[0] + nums[3] + nums[4] = (-1) + 2 + (-1) = 0.
The distinct triplets are [-1,0,1] and [-1,-1,2].
Notice that the order of the output and the order of the triplets does not matter.
Example 2:
Input: nums = [0,1,1]
Output: []
Explanation: The only possible triplet does not sum up to 0.
Example 3:
Input: nums = [0,0,0]
Output: [[0,0,0]]
Explanation: The only possible triplet sums up to 0.
1 259
Your go-to source for IELTS preparation. We offer tips, practice exercises, and expert advice to help you excel in listening, reading, writing, and speaking. Achieve your target score with our step-by-step guidance in both modules!!!
https://t.me/IELTSBoostt
1 259
ስቴም ፖወር !
ኢትዮጵያ ለሚገኙ ወጣት ሴቶች ለ3ተኛ ዙር የቀረበ ጥሪ !
ስቴም ፖወር (STEMpower) ከፊንላንድ ኤምባሲ (Embassy of Finland Ethiopia) እና ከአይቢኤም (IBM) ጋር በመተባበር በኢትዮጵያ ከ1,000 በላይ ሥራ አጥ ወጣት ሴቶችን ተግባራዊ የሥራ ክህሎት ለመስጠት ያለመ " ትጋት " የተሰኘ ፕሮግራም አስተዋውቀዋል።
ባለፉት 2 ዙሮች 1700 በላይ ለሚሆኑ ሴቶች በ Project Management, Web Development , Cyber Security, Digital Marketing , Data Analytics , Information Technology , Job Readiness , Work Readiness ስልጠና የሰጠ ከመሆኑ በተጨማሪ የስራ እድል በመፈጠር ተጠቃሚ እንዲሆኑ እድል አመቻችቷል፡፡
#ነጻ በሚሰጠውና ዓለም አቀፍ እውቅና ያለው ሰርተፊኬት በሚያስገኘው በዚህ ስልጠና እነዚህን ኮርሶች ለመውሰድ ፍላጎት ያላችሁ ሴቶች ምዝገባ የጀመርን መሆኑን እያሳወቅን ምዝገባው የሚቆየው ከመስከረም 30 እስከ ጥቅምት 10 , 2017 ዓ/ም ሲሆን ቀድማችሁ በመመዝገብ የእድሉ ተጠቃሚ እንድትሆኑ እንጋብዛለን፡፡
እነዚህን ኮርሶች ለመውሰድ ፍላጎት ያላችሁ ከስር ባለውን ሊንክ ይመዝገቡ
👉Link: https://forms.office.com/r/bJedLrdqmd
1 259
Enjoy our content? Advertise on this channel and reach a highly engaged audience! 👉🏻
It's easy with Telega.io. As the leading platform for native ads and integrations on Telegram, it provides user-friendly and efficient tools for quick and automated ad launches.
⚡️ Place your ad here in three simple steps:
1 Sign up
2 Top up the balance in a convenient way
3 Create your advertising post
If your ad aligns with our content, we’ll gladly publish it.
Start your promotion journey now!
1 259
Ultrapro የሚባል ልክ እንደ Binance Exchage በ App መጥቶላችኋል 👌
✅አዲስ እንደመሆናቸው መጠን ለአዲስ ተመዝጋቢ በነፃ 25$ እየሰጡ ነው 🥳 ይህን Giveaway መካፈል የምትችሉት እስከ ለሊቱ 6 ሰአት ብቻ ነው so ቤተሰብ ይህ እድል እንዲያመልጣችሁ አልፈልግም
✅የዚህ App ስም Ultrapro exchange " ይባላል ከ playstore ላይ ታገኙታላችው ነገር ግን አፑ እኛ አገር ስለማይሰራ በ VPN ተጠቅማችሁ አውርዱት 👌 ነገር ግን የ USA Address አትጠቀሙ
✅ቀጥሎ የምታደርጉት sign up በማድረግ በ Email regester አድርጉ
✅Refferal code ከጠየቃችሁ ይሄን አስገቡ
➡️
UTX23975490
✅Withdraw ማድረግ የሚጀምረው እንደተናገሩት ከሆነ ከነገ ጀምሮ ነው ነገር ግን KYC ነገ መጠየቅ ስለሚጀምሩ ግዴታ ነው 🤏
✅KYC ከጨረሳችሁ ገንዘባችሁን ወደፈለጋችሁት ማውጣት ትችላላችው
ነገ Appu launch ስለሚደረግ በቻላችሁት መጠን ፍጠኑ
APP LINK ➡️ https://play.google.com/store/apps/details?id=com.application.ultrapro1 259
https://t.me/catizenbot/gameapp?startapp=rp_29599749
kezih befit dogs airdrop recommended argiyachu nebr yeheme ke 11 ken beuala list yderegal silver derega deresu
1 259
🚀 Explore Palindrome Challenges with the Two-Pointer Technique!🧑💻
Palindromes are a classic problem type that can be efficiently tackled using the two-pointer technique. Whether you're just starting or looking to refine your skills, these questions will help you master this approach. Check out these palindrome problems:
1.Valid Palindrome
🔗 [Link](https://leetcode.com/problems/valid-palindrome/)
Description: Determine if a string is a palindrome, considering only alphanumeric characters and ignoring cases.
2. Valid Palindrome II
🔗 [Link](https://leetcode.com/problems/valid-palindrome-ii/)
Description: Can the string become a palindrome by deleting just one character?
3. Palindrome Linked List
🔗 [Link](https://leetcode.com/problems/palindrome-linked-list/)
Description: Check if a singly linked list is a palindrome using two pointers and a bit of list manipulation.
4. Longest Palindromic Substring
🔗 [Link](https://leetcode.com/problems/longest-palindromic-substring/)
Description: Find the longest palindromic substring in a given string, with pointers expanding from each character.
5. Palindromic Substrings
🔗 [Link](https://leetcode.com/problems/palindromic-substrings/)
Description: Count how many palindromic substrings are present in the string using two pointers.
6. Shortest Palindrome.
🔗 [Link](https://leetcode.com/problems/shortest-palindrome/)
Description: Find the shortest palindrome by adding characters to the start of the string.
7. Palindrome Partitioning
🔗 [Link](https://leetcode.com/problems/palindrome-partitioning/)
Description: Partition a string into all possible palindromic substrings.
8. Palindrome Pairs
🔗 [Link](https://leetcode.com/problems/palindrome-pairs/)
Description: Given a list of words, find all pairs of distinct indices that form palindromes.
Ready to boost your problem-solving skills? Dive into these problems, practice your two-pointer technique, and ace those palindrome challenges! 💥
Happy Coding! 💻💡
1 259
▎1. 3Sum
def threeSum(nums):
nums.sort()
result = []
for i in range(len(nums) - 2):
if i > 0 and nums[i] == nums[i - 1]:
continue
left, right = i + 1, len(nums) - 1
while left < right:
total = nums[i] + nums[left] + nums[right]
if total < 0:
left += 1
elif total > 0:
right -= 1
else:
result.append([nums[i], nums[left], nums[right]])
while left < right and nums[left] == nums[left + 1]:
left += 1
while left < right and nums[right] == nums[right - 1]:
right -= 1
left += 1
right -= 1
return result
▎2. Minimum Window Substring
from collections import Counter
def minWindow(s, t):
if not t or not s:
return ""
dict_t = Counter(t)
required = len(dict_t)
l, r = 0, 0
formed = 0
window_counts = {}
ans = float("inf"), None, None
while r < len(s):
character = s[r]
window_counts[character] = window_counts.get(character, 0) + 1
if character in dict_t and window_counts[character] == dict_t[character]:
formed += 1
while l <= r and formed == required:
character = s[l]
if r - l + 1 < ans[0]:
ans = (r - l + 1, l, r)
window_counts[character] -= 1
if character in dict_t and window_counts[character] < dict_t[character]:
formed -= 1
l += 1
r += 1
return "" if ans[0] == float("inf") else s[ans[1]: ans[2] + 1]
▎3. Fruit Into Baskets
def totalFruits(fruits):
left, right = 0, 0
basket = {}
max_fruits = 0
while right < len(fruits):
basket[fruits[right]] = basket.get(fruits[right], 0) + 1
while len(basket) > 2:
basket[fruits[left]] -= 1
if basket[fruits[left]] == 0:
del basket[fruits[left]]
left += 1
max_fruits = max(max_fruits, right - left + 1)
right += 1
return max_fruits
1 259
1. 3Sum (Hard)
Answer: The solution involves sorting the array and using a two-pointer technique to find triplets that sum to zero. The time complexity is O(n^2).
2. Minimum Window Substring (Hard)
Answer: Use a sliding window approach to maintain a count of characters and expand/shrink the window until the minimum substring is found. The time complexity is O(n).
3. Fruit Into Baskets (Easy)
Answer: Utilize a sliding window to track the types of fruits and their counts, ensuring you only have two types at any time. The maximum length of the window gives the answer. The time complexity is O(n).
1 259
Understanding the constraints, time complexity is key to solving LeetCode problems effectively. If you find these concepts confusing, don’t worry , you’re not alone!.
this might help you to undestand the constraints
1 259
3. Fruit Into Baskets (Easy)
Description: You are visiting a farm and have a basket that can hold at most two types of fruits. You want to maximize the number of fruits you collect. Given an array of integers representing the types of fruits in a row, find the maximum number of fruits you can collect in one basket.
- Example: For input
[1,2,1], the maximum number of fruits collected is 3.1 259
2. Minimum Window Substring (Hard)
Description: Given two strings
s and t, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return an empty string.
- Example: For s = "ADOBECODEBANC" and t = "ABC", the minimum window is "BANC".1 259
1. 3Sum (Hard)
Description: Given an integer array
nums, return all unique triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
- Example: For input nums = [-1,0,1,2,-1,-4], the output should be [[-1,-1,2],[-1,0,1]].
现已上线!2025 年 Telegram 研究 — 年度关键洞察 
