Counting Words With a Given Prefix | Brute Force | Trie | Leetcode 2185 | codestorywithMIK

  Рет қаралды 2,465

codestorywithMIK

codestorywithMIK

Күн бұрын

Пікірлер: 34
@AbhijeetMuneshwar
@AbhijeetMuneshwar 15 сағат бұрын
Respected MIK Sir, 🙏🏼 Tomorrow's motivational quote from my side: "True success isn't about momentary bursts of brilliance, but about consistent, disciplined action. It's about showing up day after day, making smart choices, and relentlessly pursuing your vision."
@aizad786iqbal
@aizad786iqbal 16 сағат бұрын
thanks for taking the feedback, if possible, for easy problems especially involving these complex topics like trie etc code in Java, makes it easier to remember the code also, became a member today 💚
@codestorywithMIK
@codestorywithMIK 16 сағат бұрын
Thanks for the feedback 🙏😇❤️ Also, i wanted to mention that the membership feature was given by KZbin after crossing some threshold subscribers count. I usually don’t want any paid service, so the amount for membership should be default value given by KZbin. There is no difference in the contents that I provide in membership and non-membership. So if you wish, you can definitely opt-out of the membership . Hope you understand 😇❤️🙏
@aizad786iqbal
@aizad786iqbal 15 сағат бұрын
​@@codestorywithMIK absolutely, I just hope it helps the reach of your channel since the content is awesome, It'll help a lot in achieving their goals... And get better at DSA 😊
@codestorywithMIK
@codestorywithMIK 15 сағат бұрын
@aizad786iqbal appreciate your support Aizad. Means a lot 🙏❤️😇
@ankitatiwary4663
@ankitatiwary4663 16 сағат бұрын
Thanks for explaining in Java sir
@italk-gj5kk
@italk-gj5kk 8 сағат бұрын
thanks a lot for bringing java code
@gui-codes
@gui-codes 16 сағат бұрын
I was able to solve using trie MIK. Thanks to you 🤩
@Mr-raj377
@Mr-raj377 9 сағат бұрын
Thanks for explaining in JAVA 🥺❤️
@arjunprasad1071
@arjunprasad1071 13 сағат бұрын
I watched your video of yesterday's problem ; thanks to that, I was able to solve using Trie without looking at the solution. Thanks!!
@m_fi8926
@m_fi8926 13 сағат бұрын
thanks for the java code
@Coder_Buzz07
@Coder_Buzz07 14 сағат бұрын
Thank u for the explanation bhaiya❤❤
@indianengineer5802
@indianengineer5802 16 сағат бұрын
thanks for java code
@Vibhanshushrivastava
@Vibhanshushrivastava 4 сағат бұрын
i think leetcode get obsessed with prefix and suffix , 😂😂
@sahebraojadhav9727
@sahebraojadhav9727 16 сағат бұрын
Thank u mik
@sakyasekhar4219
@sakyasekhar4219 12 сағат бұрын
Trie approach is optimal if pref is array of queries
@anonymous-qy1vw
@anonymous-qy1vw 16 сағат бұрын
let's fight
@gui-codes
@gui-codes 16 сағат бұрын
yeah bro, let's do it 🔥
@komalrani3894
@komalrani3894 3 сағат бұрын
Thanku bhaiya for solve in java please try to solve also in java
@sauravchandra10
@sauravchandra10 10 сағат бұрын
Yaay! Solved it using Trie. Python implementation: class TrieNode: def __init__(self): self.child = [None]*26 self.endWord = False class Trie: def __init__(self): self.root = TrieNode() def insert(self, word): cur = self.root for c in word: ind = ord(c)-ord('a') if not cur.child[ind]: cur.child[ind] = TrieNode() cur = cur.child[ind] cur.endWord = True def searchPrefix(self, prefix): cur = self.root for c in prefix: ind = ord(c)-ord('a') if not cur.child[ind]: return False cur = cur.child[ind] return True class Solution: def prefixCount(self, words: List[str], pref: str) -> int: cnt = 0 for word in words: if len(word) < len(pref): continue trie = Trie() trie.insert(word) if trie.searchPrefix(pref): cnt += 1 return cnt
@dayashankarlakhotia4943
@dayashankarlakhotia4943 12 сағат бұрын
One liner Solution public int prefixCount(String []words,String pref){ return (int)Arrays.stream(words).filter(s->s.startsWith(pref)).count(); }🎉❤
@darakhshannaheed2563
@darakhshannaheed2563 12 сағат бұрын
Bhaiya thanks for your solution... gfg 160 bhi chal rhi h please uske problems bhi solve krdete to acha hota... please
@rode_atharva
@rode_atharva 10 сағат бұрын
ab trie ka
@AnthonyEvans-y4e
@AnthonyEvans-y4e Сағат бұрын
Thanks for the forecast! I need some advice: I have a SafePal wallet with USDT, and I have the seed phrase. (mistake turkey blossom warfare blade until bachelor fall squeeze today flee guitar). How can I transfer them to Binance?
@kartikgandhi7447
@kartikgandhi7447 2 сағат бұрын
hi mik, just wanted to ask that can't we just create a single Trie class instead of a struct and a global function getNode and then another class Trie, confused me a bit. Brilliant explanation though!
@gayatrichaudhary580
@gayatrichaudhary580 3 сағат бұрын
java 💚💚
@vikasvoruganti7490
@vikasvoruganti7490 14 сағат бұрын
Also we can solve this using kmp
@zaffarzeshan1308
@zaffarzeshan1308 14 сағат бұрын
KMP(JAVA) class Solution { public int prefixCount(String[] words, String pref) { int n=words.length; int cnt=0; for(int i=0;i
@gauravparasar4571
@gauravparasar4571 14 сағат бұрын
Bhiya 😭 mene amazon ka oa diya thaa or 2no question ke saare test case pass hogaye the fir b select nahi hua 😢
@codestorywithMIK
@codestorywithMIK 13 сағат бұрын
Strange. Did they share you the final score ?? Because many times the remaining test cases are evaluated later. There might be large test cases or cases with corner cases.
@gauravparasar4571
@gauravparasar4571 11 сағат бұрын
@@codestorywithMIK no they didnt share anything even they said While we are not able to provide additional feedback or information about this decision
@codestorywithMIK
@codestorywithMIK 10 сағат бұрын
That’s bad and wierd. I am assuming that there might be a lot of candidates and selection might have been done by considering many other factors. Or, some hidden test cases might have faced issues (error, tle etc)
@gauravparasar4571
@gauravparasar4571 9 сағат бұрын
@@codestorywithMIK i don't know but this is my last hope to do something big even i told my parent with full excitement but in the end 🥹🥹 ab kya hoga aage mann nahi krta ab padhne ka br br rejections
@jayanaaryan3498
@jayanaaryan3498 2 сағат бұрын
bhiaya ek doubt apne bola hum root se puchte hai ye jaise 'a' present hai ya nhi if yes to aage jao uske pucho tumhare pass 't' hai ya nhi par apke code ke according hum bas node bante hai usme character assign nhi karte esse kyu?
7 Outside The Box Puzzles
12:16
MindYourDecisions
Рет қаралды 9 М.
UFC 287 : Перейра VS Адесанья 2
6:02
Setanta Sports UFC
Рет қаралды 486 М.
Netflix Removed React?
20:36
Theo - t3․gg
Рет қаралды 48 М.