- 157
- 472 405
DEEPTI TALESRA
United States
เข้าร่วมเมื่อ 20 ต.ค. 2019
Hey y'all! I'm a Cornell University alum who studied CS in the College of Engineering! Currently a SWE at Amazon:)
@deeptitalesra - links listed below:)
@deeptitalesra - links listed below:)
Isomorphic Strings #leetcode #topinterview150
Explaining Isomorphic Strings from leetcode in Python!
LeetCode 205
Code: github.com/deepti-talesra/LeetCode/blob/master/Isomorphic_Strings.py
@1:14 - Example + Explanation
@2:23 - Code
@4:49 - Code Walkthrough with Example
@6:04 - Space and Time Complexity
Music: Bensound
Lemme know if you have any comments or questions!:)))
Socials:
deeptitalesra
th-cam.com/users/deeptitalesra
Playlists:
th-cam.com/play/PL2b9acjRfGcmDEF0Piph3dDfXZdiLkk0p.html
th-cam.com/play/PL2b9acjRfGcmCOhCW1LIA2e1tvO0Gx86P.html
th-cam.com/play/PL2b9acjRfGcl-hPMbVhVtm3Nhx7o3d5my.html
th-cam.com/play/PL2b9acjRfGcl12wEB0U5MyO4EA8zO9szN.html
th-cam.com/play/PL2b9acjRfGck8msJzIqj9H3W9fLFmZ2tk.html
th-cam.com/play/PL2b9acjRfGckwHpnv_aCxU4idWcRLfoTD.html
th-cam.com/play/PL2b9acjRfGclUD8ZQPF-dyCNIeA29quSj.html
th-cam.com/play/PL2b9acjRfGckHceq_eZtt7o3me90AkgMp.html
th-cam.com/play/PL2b9acjRfGckWdp2yU_VheRcaU1EtnrMw.html
th-cam.com/play/PL2b9acjRfGcm4qYq5MH9LufsJ67-BgkAI.html
th-cam.com/play/PL2b9acjRfGcmlZY28kEJwZbvdd8BAjTMI.html
If you found this helpful, check out my channel for even **MORE VIDEOS**!!:)) th-cam.com/users/DEEPTITALESRA
Give it a shot yourself - leetcode.com/problems/isomorphic-strings/
LeetCode 205
Code: github.com/deepti-talesra/LeetCode/blob/master/Isomorphic_Strings.py
@1:14 - Example + Explanation
@2:23 - Code
@4:49 - Code Walkthrough with Example
@6:04 - Space and Time Complexity
Music: Bensound
Lemme know if you have any comments or questions!:)))
Socials:
deeptitalesra
th-cam.com/users/deeptitalesra
Playlists:
th-cam.com/play/PL2b9acjRfGcmDEF0Piph3dDfXZdiLkk0p.html
th-cam.com/play/PL2b9acjRfGcmCOhCW1LIA2e1tvO0Gx86P.html
th-cam.com/play/PL2b9acjRfGcl-hPMbVhVtm3Nhx7o3d5my.html
th-cam.com/play/PL2b9acjRfGcl12wEB0U5MyO4EA8zO9szN.html
th-cam.com/play/PL2b9acjRfGck8msJzIqj9H3W9fLFmZ2tk.html
th-cam.com/play/PL2b9acjRfGckwHpnv_aCxU4idWcRLfoTD.html
th-cam.com/play/PL2b9acjRfGclUD8ZQPF-dyCNIeA29quSj.html
th-cam.com/play/PL2b9acjRfGckHceq_eZtt7o3me90AkgMp.html
th-cam.com/play/PL2b9acjRfGckWdp2yU_VheRcaU1EtnrMw.html
th-cam.com/play/PL2b9acjRfGcm4qYq5MH9LufsJ67-BgkAI.html
th-cam.com/play/PL2b9acjRfGcmlZY28kEJwZbvdd8BAjTMI.html
If you found this helpful, check out my channel for even **MORE VIDEOS**!!:)) th-cam.com/users/DEEPTITALESRA
Give it a shot yourself - leetcode.com/problems/isomorphic-strings/
มุมมอง: 13
วีดีโอ
Sum Root to Leaf Numbers #leetcode #topinterview150
มุมมอง 1667 ชั่วโมงที่ผ่านมา
Explaining Sum Root to Leaf Numbers from leetcode in Python! LeetCode 129 Code: github.com/deepti-talesra/LeetCode/blob/master/Sum_Root_to_Leaf_Numbers.py @1:25 - Example Explanation @3:00 - Code @5:23 - Space and Time Complexity @5:46 - Code Walkthrough with Example Music: Bensound Lemme know if you have any comments or questions!:))) Socials: deeptitalesra th-cam.com/users/deep...
Average of Levels in Binary Tree #leetcode #topinterview150 #binarytree
มุมมอง 24214 ชั่วโมงที่ผ่านมา
Explaining Average of Levels in Binary Tree from leetcode in Python! LeetCode 637 Code: github.com/deepti-talesra/LeetCode/blob/master/Average_of_Levels_in_Binary_Tree.py @1:06 - Example Explanation @1:23 - Code @2:17 - Code Walkthrough with Example @5:50 - Space and Time Complexity Music: Bensound Lemme know if you have any comments or questions!:))) Socials: deeptitalesra th-ca...
Find the Index of the First Occurrence in a String #leetcode #topinterview150 #binarytree
มุมมอง 64821 ชั่วโมงที่ผ่านมา
Explaining Find the Index of the First Occurrence in a String from leetcode in Python! LeetCode 28 Code: github.com/deepti-talesra/LeetCode/blob/master/Average_of_Levels_in_Binary_Tree.py @0:46 - Example Explanation @2:15 - Code @3:58 - Code Walkthrough with Example @5:50 - Space and Time Complexity Music: Bensound Lemme know if you have any comments or questions!:))) Socials: dee...
Longest Consecutive Sequence #leetcode #blind75
มุมมอง 667วันที่ผ่านมา
Explaining Sum Root to Leaf Numbers from leetcode in Python! LeetCode 128 Can also solve this using dfs:) Code: github.com/deepti-talesra/LeetCode/blob/master/Longest_Consecutive_Sequence.py @1:02 - Example Explanation @3:53 - Code @5:32 - Space and Time Complexity @6:11 - Code Walkthrough with Example Music: Bensound Lemme know if you have any comments or questions!:))) Socials: ...
Max Consecutive Ones III #leetcode #leetcode75
มุมมอง 48714 วันที่ผ่านมา
Explaining how to solve LeetCode 1004 - Max Consecutive Ones III in Python! Code: github.com/deepti-talesra/LeetCode/blob/master/Max_Consecutive_Ones_III.py @0:59 - Example Explanation @1:23 - Code @4:35 - Code Walkthrough with Example @8:23 - Time and Space Complexity Music: Bensound Lemme know if you have any comments or questions!:))) Socials: deeptitalesra th-cam.com/users/de...
Removing Stars From a String - LeetCode 2390 - Python #leetcode75 #stack #leetcode
มุมมอง 1.2K14 วันที่ผ่านมา
Explaining how to solve Removing Stars From a String in Python! Code: github.com/deepti-talesra/LeetCode/blob/master/Removing_Stars_From_a_String.py @1:03 - Example Explanation @1:42 - Code @3:01 - Code Walkthrough with Example @5:41 - Time and Space Complexity Music: Bensound Lemme know if you have any comments or questions!:))) Socials: deeptitalesra th-cam.com/users/deeptitale...
Minimum Number of Arrows to Burst Balloons - LeetCode 452 - Python #leetcode #leetcode75 #greedy
มุมมอง 63214 วันที่ผ่านมา
Explaining how to solve Minimum Number of Arrows to Burst Balloons in Python! Code: github.com/deepti-talesra/LeetCode/blob/master/Minimum_Number_of_Arrows_to_Burst_Balloons.py @2:36 - Example Explanation @4:11 - Code @6:42 - Time and Space Complexity @7:15 - Code Walkthrough with Example Music: Bensound Lemme know if you have any comments or questions!:))) Socials: deeptitalesra...
Reverse Words in a String - LeetCode 151 - Python #leetcode75
มุมมอง 1.1K21 วันที่ผ่านมา
Explaining how to solve Reverse Words in a String from leetcode in Python! Code: github.com/deepti-talesra/LeetCode/blob/master/Reverse_Words_in_a_String.py @1:19 - Example Explanation @1:39 - Code @3:04 - Code Walkthrough with Example @3:38 - Time and Space Complexity Music: Bensound Lemme know if you have any comments or questions!:))) Socials: deeptitalesra th-cam.com/users/de...
Maximum Twin Sum of a Linked List - LeetCode 2130 - Python #leetcode75
มุมมอง 37921 วันที่ผ่านมา
Explaining how to solve Maximum Number of Vowels in a Substring of Given Length from leetcode in Python! Code: github.com/deepti-talesra/LeetCode/blob/master/Maximum_Twin_Sum_of_a_Linked_List.py @1:43 - Example Explanation @3:02 - Code @3:58 - Code Walkthrough with Example @9:09 - Time and Space Complexity Music: Bensound Lemme know if you have any comments or questions!:))) Socials: instagram....
String Compression - LeetCode 443 - Python #leetcode75 #leetcode
มุมมอง 86628 วันที่ผ่านมา
Explaining how to solve String Compression from leetcode in Python! Code: github.com/deepti-talesra/LeetCode/blob/master/String_Compression.py @2:08 - Example Explanation @3:32 - Code @8:36 - Code Walkthrough with Example @11:27 - Time and Space Complexity Music: Bensound Lemme know if you have any comments or questions!:))) Socials: deeptitalesra th-cam.com/users/deeptitalesra P...
Merge k Sorted Lists - LeetCode 23 - Python #heap #leetcode #linkedlist
มุมมอง 485หลายเดือนก่อน
Explaining how to solve Merge k Sorted Lists in Python! Code: github.com/deepti-talesra/LeetCode/blob/master/Merge_k_Sorted_Lists.py @0:33 - Example Explanation @4:39 - Code @10:01 - Time and Space Complexity @12:47- Code Walkthrough with Example Merge Two Sorted Lists - th-cam.com/video/RkQ4t9t_c74/w-d-xo.htmlsi=293N7bilUt1Et5FT Binary Search - th-cam.com/video/tHXHNauyhHs/w-d-xo.html Heap Doc...
Top K Frequent Elements - LeetCode 347 - Python #leetcode #blind75 #heap
มุมมอง 821หลายเดือนก่อน
Explaining how to solve Top K Frequent Elements from leetcode in Python! Code: github.com/deepti-talesra/LeetCode/blob/master/Top_K_Frequent_Elements.py @1:17 - Explanation Code @3:19 - Code Walkthrough with Example @5:35 - Time Complexity @7:08 - Space Complexity Music: Bensound Lemme know if you have any comments or questions!:))) Socials: deeptitalesra th-cam.com/users/deeptit...
Count Good Nodes in Binary Tree #leetcode #leetcode75
มุมมอง 504หลายเดือนก่อน
Explaining how to solve 1448. Count Good Nodes in Binary Tree from leetcode in Python! Code: github.com/deepti-talesra/LeetCode/blob/master/Count_Good_Nodes_in_Binary_Tree.py @1:52 - Example Explanation @3:24 - Code @5:49 - Code Walkthrough with Example @10:52 - Time and Space Complexity Music: Bensound Lemme know if you have any comments or questions!:))) Socials: deeptitalesra ...
Reverse Vowels of a String - LeetCode 345 - Python #leetcode #2pointers #leetcode75
มุมมอง 735หลายเดือนก่อน
Explaining how to solve Reverse Vowels of a String in Python! Code: github.com/deepti-talesra/LeetCode/blob/master/Reverse_Vowels_of_a_String.py @0:32 - Example Explanation @1:35 - Code @2:35 - Code Walkthrough with Example @6:26 - Time and Space Complexity Music: Bensound Lemme know if you have any comments or questions!:))) Socials: deeptitalesra th-cam.com/users/deeptitalesra ...
Equal Row and Column Pairs - LeetCode 2352 - Python #leetcode #leetcode75
มุมมอง 1.3Kหลายเดือนก่อน
Equal Row and Column Pairs - LeetCode 2352 - Python #leetcode #leetcode75
Max Number of K-Sum Pairs - LeetCode 1679 - Python #leetcode #leetcode75 #2pointers
มุมมอง 697หลายเดือนก่อน
Max Number of K-Sum Pairs - LeetCode 1679 - Python #leetcode #leetcode75 #2pointers
N-th Tribonacci Number - LeetCode 1137 - Python #leetcode75 #dynamicprogramming
มุมมอง 758หลายเดือนก่อน
N-th Tribonacci Number - LeetCode 1137 - Python #leetcode75 #dynamicprogramming
Determine if Two Strings Are Close - Python #leetcode #leetcode75
มุมมอง 652หลายเดือนก่อน
Determine if Two Strings Are Close - Python #leetcode #leetcode75
Maximum Average Subarray I - LeetCode 643 - Python #leetcode #leetcode75
มุมมอง 731หลายเดือนก่อน
Maximum Average Subarray I - LeetCode 643 - Python #leetcode #leetcode75
Unique Number of Occurrences - LeetCode 1207 - Python #leetcode #leetcode75
มุมมอง 762หลายเดือนก่อน
Unique Number of Occurrences - LeetCode 1207 - Python #leetcode #leetcode75
Find the Highest Altitude - LeetCode 1732 - Python #leetcode #leetcode75
มุมมอง 8702 หลายเดือนก่อน
Find the Highest Altitude - LeetCode 1732 - Python #leetcode #leetcode75
Daily Temperatures - LeetCode 739 - Python #leetcode #stack
มุมมอง 5962 หลายเดือนก่อน
Daily Temperatures - LeetCode 739 - Python #leetcode #stack
Odd Even Linked List - LeetCode 328 - Python #leetcode #leetcode75
มุมมอง 6552 หลายเดือนก่อน
Odd Even Linked List - LeetCode 328 - Python #leetcode #leetcode75
Can Place Flowers - LeetCode 605 - Python #leetcode #leetcode75
มุมมอง 7582 หลายเดือนก่อน
Can Place Flowers - LeetCode 605 - Python #leetcode #leetcode75
Maximum Number of Vowels in a Substring of Given Length - LeetCode 1456 - Python #leetcode75
มุมมอง 1.3K2 หลายเดือนก่อน
Maximum Number of Vowels in a Substring of Given Length - LeetCode 1456 - Python #leetcode75
Rotting Oranges - LeetCode 994 - Python #bfs #leetcode #leetcode75
มุมมอง 1.1K2 หลายเดือนก่อน
Rotting Oranges - LeetCode 994 - Python #bfs #leetcode #leetcode75
Delete Node in a BST - LeetCode 450 - Python #leetcode #leetcode75
มุมมอง 4952 หลายเดือนก่อน
Delete Node in a BST - LeetCode 450 - Python #leetcode #leetcode75
Kids With the Greatest Number of Candies - LeetCode 1431 - Python #leetcode #leetcode75
มุมมอง 3432 หลายเดือนก่อน
Kids With the Greatest Number of Candies - LeetCode 1431 - Python #leetcode #leetcode75
Longest Subarray of 1's After Deleting One Element - LeetCode 1493 Python #leetcode #slidingwindow
มุมมอง 5442 หลายเดือนก่อน
Longest Subarray of 1's After Deleting One Element - LeetCode 1493 Python #leetcode #slidingwindow
You are smart + beautiful
Why do we assume that each node object will have a list from its of values for all its leaves? Why do we not have to go through the process of traversal? I do not get it.
You are good at this, please keep going.
This video definitely showed us how to solve it, but I feel like the speed you are providing information and editing the video makes it a little harder to digest and learn what you are teaching. Your older videos were easier to have the concepts click but in this, things are moving too fast.
one of the best explanations for this problem!! i was having so much trouble with this specific question and after listening closely to your explanation and seeing your code, it became so much more clear. thank you! thank you! thank you!!!!!
Nice solution. I did it a little differently by converting to a string. th-cam.com/video/MO1PpDjbVt4/w-d-xo.html
Your video for this is the only one that made it clear how we switch from the left side to the right with pop. It should be so easy to understand, but I was having trouble mentally visioning all the moving parts. Thanks to you showing the flow step by step of the loops, I understand this very well.
"You are doing well, ma'am, and we really appreciate your efforts. However, could you please slow down a bit? We are beginners, and it's hard for us to grasp everything at such speed. Also, we have a small request regarding the attire: as students, when we watch such videos at home, our parents sometimes comment on it, and it creates a little discomfort. Thank you for understanding, and apologies if this comes across the wrong way."
Nice explanation Deepti!
Its a blessing to watch your videos.
Great explanation !!
Amazing effort. Keep it up.
Lovely explanation from a lovely person.
❤your videos.
How to watch the hidden videos?
Loved the explaination! You made it very simple to understand
Great solution video! Request to solve Leetcode Problem 4. Median of Two Sorted Arrays if possible, thank you!
So godo😮
Using the Knuth-Morris-Pratt (KMP) algorithm, which is very efficient for large texts and patterns. The KMP algorithm works in O(m + n) time complexity, where: m is the length of the needle n is the length of the haystack class Solution: def strStr(self, haystack: str, needle: str) -> int: # Step 1: Edge case, if needle is empty, return 0 as per problem statement if len(needle) == 0: return 0 # Step 2: Build the LPS array for the needle def build_lps(needle: str) -> list: lps = [0] * len(needle) # LPS array of the same length as needle length = 0 # Length of the previous longest prefix suffix i = 1 while i < len(needle): if needle[i] == needle[length]: length += 1 lps[i] = length i += 1 else: if length != 0: length = lps[length - 1] # Try the previous longest prefix suffix else: lps[i] = 0 i += 1 return lps # Step 3: Use the LPS array to search for the needle in the haystack lps = build_lps(needle) i = 0 # index for haystack j = 0 # index for needle while i < len(haystack): if haystack[i] == needle[j]: i += 1 j += 1 if j == len(needle): return i - j # Match found, return the start index elif i < len(haystack) and haystack[i] != needle[j]: if j != 0: j = lps[j - 1] # Skip to the next possible match in the needle else: i += 1 # No match found, move to the next character in haystack return -1 # Needle not found in haystack
Regarding: LPS Array Construction here is an example Input: haystack = "sadbutsad", needle = "sad" For the needle = "sad": Let's construct the LPS array step by step: First, we create an LPS array of the same length as the pattern (needle) Length of "sad" = 3, so LPS array size = 3 LPS array construction rules: LPS[0] is always 0 For other positions, we find the longest proper prefix which is also a suffix Let's build it: Pattern: s a d Index: 0 1 2 LPS: 0 0 0 Step-by-step process: i = 0: LPS[0] = 0 (always) i = 1: Compare 's' and 'a' They don't match LPS[1] = 0 i = 2: Compare 's' and 'd' They don't match LPS[2] = 0 Final LPS array: [0, 0, 0] another example: Input: haystack = "sadbutsad", needle = "sade" Let's construct the LPS array step by step: First, create an LPS array of the same length as the pattern (needle) Length of "sade" = 4, so LPS array size = 4 LPS array construction rules: LPS[0] is always 0 For other positions, find the longest proper prefix which is also a suffix Pattern: s a d e Index: 0 1 2 3 LPS: 0 0 0 0 Step-by-step process: i = 0: LPS[0] = 0 (always) i = 1: Compare 's' and 'a' They don't match LPS[1] = 0 i = 2: Compare 's' and 'd' They don't match LPS[2] = 0 i = 3: Compare 's' and 'e' They don't match LPS[3] = 0 haystack: s a d b u t s a d needle: s a d e LPS: 0 0 0 0 Step 1: Match 's' at i=0 Step 2: Match 'a' at i=1 Step 3: Match 'd' at i=2 Step 4: Mismatch at i=3 ('b' ≠ 'e') - Use LPS to shift pattern - j = lps[2] = 0 Step 5: Start matching from beginning of needle Step 6: Continue until end of haystack
Two pointer, aur prod variable leke ke lete
great explanation and easy to understand code!! thank you!
those who are here looking for this solution are probably trying to crack FAANG interviews. Every FAANG interviewer knows the heap approach won't cut it anymore. KEKW
Wow great vid and explanation!!
It was a very good explanation.
very nice explanation
👁👄👁
instead of the second while loop we could do "if" cuz we're at most running it once.
# using BFS from collections import deque from typing import List class Solution: def longestConsecutive(self, nums: List[int]) -> int: if not nums: return 0 # Convert nums to set for O(1) lookup num_set = set(nums) visited = set() max_length = 0 def bfs(num): queue = deque([num]) visited.add(num) sequence_length = 1 # Check both directions (left and right) left = right = num # Expand to left while left - 1 in num_set and left - 1 not in visited: left -= 1 queue.append(left) visited.add(left) sequence_length += 1 # Expand to right while right + 1 in num_set and right + 1 not in visited: right += 1 queue.append(right) visited.add(right) sequence_length += 1 return sequence_length # Try BFS from each number that hasn't been visited for num in nums: if num not in visited: max_length = max(max_length, bfs(num)) return max_length
Let's visualize how the BFS solution works with nums = [100,4,200,1,3,2] Initial array: [100, 4, 200, 1, 3, 2] Step-by-step visualization: 1. Convert to set: {1, 2, 3, 4, 100, 200} visited = {} 2. Start with first number (100): 100 → Check: 99? No 101? No Sequence: [100] visited = {100} Length = 1 max_length = 1 3. Next unvisited number (4): 4 → Check: 3? Yes 5? No 3 → Check: 2? Yes 2 → Check: 1? Yes Sequence: [1, 2, 3, 4] visited = {100, 1, 2, 3, 4} Length = 4 max_length = 4 4. Next unvisited number (200): 200 → Check: 199? No 201? No Sequence: [200] visited = {100, 1, 2, 3, 4, 200} Length = 1 max_length = 4 Visual representation: Numbers on number line: 1 - 2 - 3 - 4 ... 100 ... 200 └─────────┘ │ │ 4 1 1 └── Longest sequence Sequence discovery: 100: ● Length = 1 4: ● ─ ● ─ ● ─ ● 4 3 2 1 Length = 4 200: ● Length = 1 Final Result: 4 (longest consecutive sequence: [1,2,3,4])
thanks for this solution!
this is the only video i can coprehend for lc. 334. thx
No proper explanation of return statement it's like mugging up
great thank you
I was doing this problem and couldn't figure it out. Glad you uploaded the solution today and I really like the way you walk us through your solution step by step. Kudos for doing this!
Just a quick thought :- if you put that end+=1 on top of max_ones you dont need to +1 inside the max() just (end - start) is enough
great thank you
these also works 🤷♂ while even and even.next: odd.next = even.next odd = even.next even.next = odd.next even = odd.next odd.next = even_head return head and while even and even.next: odd.next = odd.next.next # skipping one elem odd = odd.next # updating the odd # doing same for even even.next = even.next.next even = even.next odd.next = even_head return head
haha so simple const str = 'J*ave*d' function removeStarFromStr(str){ if(typeof str !== 'string') return "Invalid Type!!"; let result = [] for(const item of str){ if(item === '*'){ if(result.length > 0){ result.pop() } }else{ result.push(item) } } return result.join("") } console.log(removeStarFromStr(str))
I did not see an import of heapq, for heappush and heappop, and your explanation shown we would get an output of [1,4], while the explanation in leetcode shown an output of [1, 2], what is happening, make me understand
did you figured where it went wrong , coz I got no error for same input , working fine but I think you may have misfigured the working of heap
The solution shown in the video is copied from ChatGPT lol
🎉🎉🎉❤❤❤😊😊 super. I can understand that code. But one small doubt. We just removing star before character , but * is stay , that how going to be deleted??? 2 What is the concept ?
Do videos on system design
Elegant and simple + walkthrough for easy understanding code. I enjoy watching your LC videos.
The hashmap explanation made the most sense compared to the other videos I watched. I really like that you go through an example. It helps a lot. Thank you!
Though you're doing fantastic, I have more thing to ask: please slow down. You're explaining things so quickly.
You made my Diwali happy.
Happy Diwali sis✨️ 😊
I Love You, Ma'am ! You are soooo beautiful yet so simple!
PY IS FOR NEWBIES ,DO IT USING C
Companies accept python, what’s the point
@@armaan9907 you must be fun at parties
@@brichie7095 how’s that even related
Thanks!
Loved your solution.