LeetCode 1657. Determine if Two Strings Are Close - Interview Prep Ep 100

  Рет қаралды 3,797

Fisher Coder

3 жыл бұрын

⭐ Shop on Amazon to support me: www.amazon.com/?tag=fishercoder0f-20
⭐ NordVPN to protect your online privacy: go.nordvpn.net/aff_c?offer_id=15&aff_id=82405&url_id=902
⭐ NordPass to help manage all of your passwords: go.nordpass.io/aff_c?offer_id=488&aff_id=82405&url_id=9356
Problem link: leetcode.com/problems/determine-if-two-strings-are-close/
⭐ Support my channel and connect with me:
kzbin.info/door/PL5uAbYQ40HwAdOe4ikI0wjoin
Algorithm:
Based on the definition of the two given operations, we can infer these:
1. the order of each of the letter in the two words doesn't matter any more;
2. we need to make sure all unique characters that appear in word1 does also appear in word2.
// TOOLS THAT I USE:
○ Memory Foam Set Keyboard Wrist Rest Pad - amzn.to/3cOGOAj
○ Electric Height Adjustable Standing Desk - amzn.to/2S9YexJ
○ Apple Magic Keyboard (Wireless, Rechargable) - amzn.to/36gy5FJ
○ Apple Magic Trackpad 2 (Wireless, Rechargable) - amzn.to/36ltimu
○ Apple MacBook Pro - amzn.to/30iSvKE
○ All-In One Printer - amzn.to/34etmSi
○ Apple AirPods Pro - amzn.to/2GpVYQf
○ My new favorite Apple Watch - amzn.to/2EIIUFd
// MY FAVORITE BOOKS:
○ Introduction to Algorithms - amzn.to/36hxHXD
○ Designing Data-Intensive Applications - amzn.to/2S7snOg
○ Head First Java - amzn.to/2ScLDKa
○ Design Patterns - amzn.to/2SaGeU2
Follow me on Github for more LeetCode solutions: github.com/fishercoder1534/Leetcode
Support me on Patreon: www.patreon.com/fishercoder
My ENTIRE Programming Equipment and Computer Science Bookshelf:
www.amazon.com/shop/fishercoder
And make sure you subscribe to my channel before you leave!
Your comments/thoughts/questions/advice will be greatly appreciated!
#softwareengineering #leetcode #algorithms #coding #interview #SDE #SWE #SiliconValley #programming #datastructures

Пікірлер: 11
@varunpalsingh3822
@varunpalsingh3822 9 ай бұрын
you way of explanation is good
@FisherCoder
@FisherCoder 9 ай бұрын
Glad it was helpful!
@siddharthgupta848
@siddharthgupta848 3 жыл бұрын
keep producing these leetcode videos daily, it is really so valuable.Thanks
@kevinmanuel6711
@kevinmanuel6711 3 жыл бұрын
This is brilliant!
@NikolayMishin
@NikolayMishin Жыл бұрын
cool explanation, thank you!
@FisherCoder
@FisherCoder Жыл бұрын
Glad it was helpful!
@Meenereem
@Meenereem 11 ай бұрын
Thank you!
@FisherCoder
@FisherCoder 11 ай бұрын
You're welcome!
@amintalukder7189
@amintalukder7189 Жыл бұрын
I did not understand why count1 and count2 should be equal here ? they sometimes can not be equal, is not it ?
@mhmd5ld81
@mhmd5ld81 Жыл бұрын
I think because u r mapping characters by their frequency for example if I got 3 "a" in word1 and I got 3 "z" in word2, 'a' is at the first of the list word1 and z is at the bottom of the list word2 so we want to perform the 2 operations and in order to do that we need to check the equality of frequent chars so we need to sort each list and comparing them and yes the two count lists could not be equal and that misses with the 2 operations so we return false
@abdulmziya748
@abdulmziya748 3 ай бұрын
Is there a way to solve this at linear time if we use a hashmap?
Mom had to stand up for the whole family!❤️😍😁
00:39
Бенчик, пора купаться! 🛁 #бенчик #арти #симбочка
00:34
Симбочка Пимпочка
Рет қаралды 3 МЛН
Seja Gentil com os Pequenos Animais 😿
00:20
Los Wagners
Рет қаралды 24 МЛН
Mom had to stand up for the whole family!❤️😍😁
00:39