Thank you sir aapke solution video dekh dekh ke main daily question practice karta hu. I am a total beginner but 3 days tak ki consistency hain daily question mein
i think we dont need 2 for loops we can do it in one pass def isAnagram(self, s: str, t: str) -> bool: if len(s)!=len(t): return False freq=[0 for i in range(26)] for i in range(len(s)): freq[ord(s[i])-ord('a')]+=1 freq[ord(t[i])-ord('a')]-=1 for i in range(26): if freq[i]>0: return False return True
Consistency++❤❤
Hats off to your consistency. I got to learn a lot from you . I wish i had got this channel in early 2023. But it’s ok.
2024 I AM READY
I am definitely a big fan of your teaching.
building intuitions non stop bcs of your help. Thanks MIK
Thank you sir aapke solution video dekh dekh ke main daily question practice karta hu. I am a total beginner but 3 days tak ki consistency hain daily question mein
❤️❤️🙏🙏
Thank you , you have improved by DSA and logical skills during this year 2023.
Thanks a lot
I got the Annual badge. Thanks Bhaiya 💖
received 3 badges yesterday ❤❤❤
Awesome 🔥
Congratulations
class Solution {
public boolean isAnagram (String s,String t){
if(s.length()!=t.length ()) return false;
int[]cnt=new int [128];
for(char c:s.toCharArray ())
++cnt[c];
for(char c:t.toCharArray())
if(--cnt[c]
❤❤
I got the Annual badge. Thanks to you MIK sir
pls upload geeksforgeeks potd solutions also
2:00 how someone can sort the string in O(1) space complexity i.e. without converting String into char array?
i think we dont need 2 for loops we can do it in one pass
def isAnagram(self, s: str, t: str) -> bool:
if len(s)!=len(t):
return False
freq=[0 for i in range(26)]
for i in range(len(s)):
freq[ord(s[i])-ord('a')]+=1
freq[ord(t[i])-ord('a')]-=1
for i in range(26):
if freq[i]>0:
return False
return True
Yes. I also though the same.
Loved this. Thanks for sharing ❤
❤
Yo🎉
// java code ;)
class Solution {
public boolean isAnagram(String s, String t) {
char[] s1 = s.toCharArray();
char[] t1 = t.toCharArray();
Arrays.sort(s1);
Arrays.sort(t1);
return Arrays.equals(s1, t1);
}
}
I got this question in suggestions.... 438. Find All Anagrams in a String....do you mind explaining this?
Let me check soon
first approach come to my mind is XOR, tried some cases passed some not can anyone explain why??
Why in December it is giving so easy question its like half a month all easy questions except 1 was medium,but was too easy too.
Solved this on my own and optimised it too🥹
❤❤❤❤