Check if string is pangram | String Interview Question

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

КОМЕНТАРІ • 10

  • @a6xx824
    @a6xx824 7 місяців тому +1

    Sir this is simplist that anyone has explain all salo auro ko khud nhi pta ky bol rhe hai really thank you appreciate❤😊

  • @photos9350
    @photos9350 2 місяці тому +1

    you were solving this question on leetcode and today i did the same solution as yours which beats only 20% in both time an space ,
    best solution would be:
    int arr[26]={0};
    for(int i=0;i

  • @alexandresendra
    @alexandresendra 2 роки тому +1

    What if you do :
    std::map myMap;
    for each character {
    myMap[e] = true;
    }
    return myMap.Size() == 26
    Is it faster ?

    • @CppNuts
      @CppNuts  2 роки тому

      No, because with tree there will be cache miss, but with array as the size is 26 it is possible that once it will load the entire array in cache and wound never go back to RAM.

  • @aby_yadav
    @aby_yadav 2 роки тому +1

    My psudo solution:
    unordered_set tset;
    for(const auto& ch : input_str){
    tset.insert(tolower(ch));
    return true if tset.size()==26;
    }
    return false;

  • @nikhilreddy6476
    @nikhilreddy6476 2 роки тому

    I think your algorithm will continue checking for the whole string(lets say length is 10000000) and what will happen if the first 26 elements will already have A-Z ? then we keep on checking the rest of string? i think it might be unnecessary. I would prefer vector to be int rather than bool and for every first time we encounter new letter I will increment counter and when counter reaches 26 i will return true. if not false.

    • @CppNuts
      @CppNuts  2 роки тому

      This should work with very big string, but I doubt also because we would need two extra things, increment and if check. So in average it might slow down also.
      But not sure, we should check.
      Because the worst case might be like we have all A from beginning and in the end B - Z then we have to pay very big penalty.

  • @mdtarikbosunia2435
    @mdtarikbosunia2435 2 роки тому

  • @aloklinku
    @aloklinku 2 роки тому

    👍