Check if string is pangram | String Interview Question

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ก.ย. 2024
  • JOIN ME
    -----
    TH-cam 🎬 / @cppnuts
    Patreon 🚀 / cppnuts
    COMPLETE PLAYLIST
    ------------
    C++ Tutorial For Beginners: • Introduction To C++
    STL (Standard Template Library): • STL In C++
    ThreadIng In C++: • Multithreading In C++
    Data Structures: • Data Structure
    Algorithms: • Binary Search
    Design Patterns: • Factory Design Pattern...
    Smart Pointers: • Smart Pointer In C++
    C++14: • Digit Separator In C++
    C++17: • std string_view in C++...
    C++ All Type Casts: • static_cast In C++
    INTERVIEW PLAYLIST
    ------------
    C++ Interview Q&A: • Structural Padding & P...
    C++ Interview Q&A For Experienced: • How delete[] Knows How...
    Linked List Interview Questions: • Find Kth Node From Bac...
    BST Interview Questions: • Search Element In Bina...
    Array Interview Questions: • Reverse An Array
    String Interview Questions: • Check String Is Palind...
    Bit Manipulation Questions: • Find Set Bit In Intege...
    Binary Tree Interview Question: • Invert Binary Tree
    Sorting Algorithms: • Bubble Sort
    C++ MCQ: • Video
    C MCQ: • What printf returns af...
    C Interview Questions: • Designated Initializat...
    QUICK SHORT VIDEOS
    -------------
    C++ Short : • C++ Short Videos
    C Short : • Shorts C Programming MCQ
    In this video we will learn how to check if given string is pangram or not.
    I have explained a very simple and faster approach to this problem.
    #cpp #string #programming #interviewquestion #computerscience

ความคิดเห็น • 9

  • @a6xx824
    @a6xx824 2 หลายเดือนก่อน

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

  • @alexandresendra
    @alexandresendra ปีที่แล้ว

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

    • @CppNuts
      @CppNuts  ปีที่แล้ว

      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 ปีที่แล้ว

    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 ปีที่แล้ว

    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  ปีที่แล้ว

      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 ปีที่แล้ว

  • @aloklinku
    @aloklinku ปีที่แล้ว

    👍