No video

Leetcode - Determine if Two Strings Are Close (Python)

  Рет қаралды 4,995

Timothy H Chang

Timothy H Chang

Күн бұрын

Пікірлер: 12
@TimBrownYoutube
@TimBrownYoutube 4 ай бұрын
Wanted to share refactored version: def closeStrings(self, word1: str, word2: str) -> bool: hist1 = Counter(word1) hist2 = Counter(word2) hist3 = Counter(hist1.values()) hist4 = Counter(hist2.values()) return hist3 == hist4 and set(word1) == set(word2)
@muzaffartursunov324
@muzaffartursunov324 7 ай бұрын
How do you come up with such a great ideas?! I appreciate it! Thank you Tim!
@Alpha16212
@Alpha16212 8 ай бұрын
great explanation! thanks a lot for this!
@patrikm8389
@patrikm8389 7 ай бұрын
I think you can remove the c1==c2 condition as it should already be included in the second condition. if c1 equals c2 means that both strings share the same set of chars and the same distribution of counts Thanks a lot for the videos, watched a couple and they were short but very clear and easy to understand
@onetwothree164
@onetwothree164 7 ай бұрын
was thinking the same thing as well :)
@waleeddib7096
@waleeddib7096 3 жыл бұрын
The first thing that comes to your mind is recursion. Every single time lol
@timc3406
@timc3406 3 жыл бұрын
Tell me about it!
@bricksnbuttons2000
@bricksnbuttons2000 7 ай бұрын
Great explanation! Thanks!
@chickaberga2
@chickaberga2 3 жыл бұрын
Why did you do a list comprehension [v for v in c1.values()]? Is this not just the same as simply c1.values()?
@timc3406
@timc3406 3 жыл бұрын
Doh good point!
@liliiarudenko
@liliiarudenko 7 ай бұрын
great video 😎
@am_rxd
@am_rxd 11 ай бұрын
damn it sefficent as fuck
Leetcode - Max Number of K-Sum Pairs (Python)
5:43
Timothy H Chang
Рет қаралды 6 М.
나랑 아빠가 아이스크림 먹을 때
00:15
진영민yeongmin
Рет қаралды 14 МЛН
Мы сделали гигантские сухарики!  #большаяеда
00:44
Nurse's Mission: Bringing Joy to Young Lives #shorts
00:17
Fabiosa Stories
Рет қаралды 14 МЛН
1657. Determine if Two Strings Are Close - Day 14/31 Leetcode January Challenge
20:04
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 302 М.
Equal Row and Column Pairs - LeetCode 2352 - Python
10:21
Alpha-Code
Рет қаралды 309
So You've Been Rejected from FAANG
5:56
Timothy H Chang
Рет қаралды 8 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 803 М.
Find the Difference of Two Arrays - Leetcode 2215 - Python
7:34
Leetcode 2352 Equal Row and Column Pairs | Easy Peasy Maps
8:07
Coding Decoded
Рет қаралды 6 М.
How to Use the Two Pointer Technique
10:56
Team AlgoDaily
Рет қаралды 100 М.
UNIQUE NUMBER OF OCCURENCES | LEETCODE 1207 | PYTHON SOLUTION
10:31
Cracking FAANG
Рет қаралды 1,1 М.
나랑 아빠가 아이스크림 먹을 때
00:15
진영민yeongmin
Рет қаралды 14 МЛН