Valid Anagram | 2 Approaches | Leetcode-242 | UBER

Поділитися
Вставка
  • Опубліковано 23 січ 2025

КОМЕНТАРІ • 27

  • @DevOpskagyaan
    @DevOpskagyaan Рік тому +8

    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

  • @adarshjha5126
    @adarshjha5126 Рік тому +9

    Consistency++❤❤

  • @drishtid4943
    @drishtid4943 Місяць тому +1

    I am definitely a big fan of your teaching.
    building intuitions non stop bcs of your help. Thanks MIK

  • @aadarshpandit2929
    @aadarshpandit2929 Рік тому +2

    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

  • @FanIQQuiz
    @FanIQQuiz Рік тому

    Thank you , you have improved by DSA and logical skills during this year 2023.

  • @DeepakGupta_er
    @DeepakGupta_er 4 місяці тому

    2:00 how someone can sort the string in O(1) space complexity i.e. without converting String into char array?

  • @souravjoshi2293
    @souravjoshi2293 Рік тому

    I got the Annual badge. Thanks to you MIK sir

  • @oqant0424
    @oqant0424 Рік тому +1

    I got the Annual badge. Thanks Bhaiya 💖

  • @dayashankarlakhotia4943
    @dayashankarlakhotia4943 Рік тому +3

    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]

  • @tutuimam3381
    @tutuimam3381 Рік тому +1

    Thanks a lot

  • @Ankit_Maurya_12
    @Ankit_Maurya_12 5 місяців тому

    first approach come to my mind is XOR, tried some cases passed some not can anyone explain why??

  • @codeandtalk6
    @codeandtalk6 Рік тому +5

    received 3 badges yesterday ❤❤❤

  • @saurabhKumar-hj6yp
    @saurabhKumar-hj6yp Рік тому +1

    ❤❤

  • @Strawcontamination
    @Strawcontamination Рік тому +1

    pls upload geeksforgeeks potd solutions also

  • @jagadeeshp1163
    @jagadeeshp1163 Рік тому +2

    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

  • @yadav.nitin03
    @yadav.nitin03 Рік тому +1

    Yo🎉

  • @utkarshsahay9908
    @utkarshsahay9908 Рік тому

  • @WiFiWaLaaa
    @WiFiWaLaaa Рік тому +2

    // 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);
    }
    }

  • @anushkathakur6531
    @anushkathakur6531 Рік тому +1

    I got this question in suggestions.... 438. Find All Anagrams in a String....do you mind explaining this?

  • @Ramneet04
    @Ramneet04 Рік тому

    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.

  • @oqant0424
    @oqant0424 Рік тому +1

    Solved this on my own and optimised it too🥹

  • @iamvtyagii9540
    @iamvtyagii9540 Рік тому

    ❤❤❤❤