Construct K Palindrome Strings | Super Detailed Intuition | Leetcode 1400 | codestorywithMIK

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

КОМЕНТАРІ • 62

  • @khushityagi4461
    @khushityagi4461 Годину тому +2

    SOOO much effort MIK Sir.Thankyouu for teaching soo well ,could not help soo commenting

  • @utkarsh-k6p
    @utkarsh-k6p 5 годин тому +4

    solved It in 2 minutes . Just imagine if we have a string and we have to check palindrome so the number of odd frequency of a character should be 0 or 1 ... Thank you Bhaiyaa for your amazing Teaching skills . You are Gem.

  • @rathodkiran02
    @rathodkiran02 2 години тому +2

    I have been doing daily problem from last 10 days and today before seeing your explanation i solved the problem in same way, and went through ur full video, Thankyou bhaiya your consistency making me to work daily❤ You are big motivation.

    • @codestorywithMIK
      @codestorywithMIK  Годину тому

      I am glad my videos motivate you to work daily. Keep it up! 💪💪🔥🔥❤️❤️

  • @EB-ot8uu
    @EB-ot8uu 7 годин тому +8

    I can see the hard work you put in your videos, you explain multiple examples and the stress you put in the video so that even beginners can understand is commendable. I salute you for your dedication.
    You don't care about views, you care about the quality. This makes you different from other youtubers. I bet no one would have made a detailed video on this problem like you did. Seemed like a complete interview

  • @Aryan-cy7cu
    @Aryan-cy7cu 7 годин тому +15

    i solved it by my own after 1.5 hr time , i surprised see i used same method (count odd frequencies)

    • @unknown47896
      @unknown47896 2 години тому

      same here bro

    • @gui-codes
      @gui-codes 34 хвилини тому

      mai odd frequency waale me stuck hogaya tha yaar. Almost solve hogaya tha. but then solve karliya after hint from here.
      How many Qns you guys practice in a week or day ?

  • @ayushbudhlakoti2004
    @ayushbudhlakoti2004 Годину тому +1

    well explained brother

  • @jayeshverma7049
    @jayeshverma7049 6 годин тому +3

    Hi thanks brother for such efforts...i am new to dsa and you are helping me a lot
    thanks for these hindi videos

    • @codestorywithMIK
      @codestorywithMIK  6 годин тому

      I’m glad my videos are helping you. Keep it up! ❤️🙏

  • @priyabratashee4975
    @priyabratashee4975 7 годин тому +5

    Bhaiyaaa lots of love and appreciation for your hard work ❤❤❤

  • @oppo-px5hf
    @oppo-px5hf 4 години тому +2

    bro you are RONALDO OF explaining stuff with simple way. Please never stop this :) Thanks for doing this nd soo you will be getting silver play button can u please do face revel :) in 2025 ??

  • @saloneee7253
    @saloneee7253 3 години тому

    Now that i see the video , the logic was simple. But couldn't think of the approach on my own . Thanks.

  • @aastikofficial6100
    @aastikofficial6100 2 години тому +1

    Growth is a steady rise, unseen but unstoppable
    Motivation++;

  • @aizad786iqbal
    @aizad786iqbal 8 годин тому +5

    Java ki hattrick yay🎉❤

  • @BeingInspired1
    @BeingInspired1 3 години тому

    gajab, kamal, majedar💥💥💥

  • @aws_handles
    @aws_handles 7 годин тому

    I was very close to solving this completely. Just paused your video in the mid and got it. Hats off to your detailed points in the explanation. ❤

  • @italk-gj5kk
    @italk-gj5kk 5 годин тому +1

    thanks for java code

  • @codingwithsukesh
    @codingwithsukesh 6 годин тому +1

    Superb explanation ❤❤

  • @souravjoshi2293
    @souravjoshi2293 7 годин тому

    mast explanation. done easily. examples helped a lot

  • @aryanmishra199
    @aryanmishra199 4 години тому +1

    Goated channel

  • @vinaydanidhariya
    @vinaydanidhariya 6 годин тому +1

    awesome explaination !!!

  • @eprithvikushwah4754
    @eprithvikushwah4754 8 годин тому +5

    Simple Solution (Pin)
    approach-
    step 1 : Calculate the frequency of characters in String.
    step 2 : count odd characters
    step 3 : if odd characters are greater than k --> return false
    else return true;
    class Solution {
    public:
    bool canConstruct(string s, int k) {

    if(s.size() < k) return false;
    unordered_map m;
    for(char &ch:s)m[ch]++;
    int odd = 0;

    for(auto &ele : m){
    if(ele.second % 2 == 0)even++;
    else odd++;
    }
    if(odd

  • @wearevacationuncoverers
    @wearevacationuncoverers 7 годин тому

    I pray you reach Million soon MIK

  • @Sabos-Hat
    @Sabos-Hat 8 годин тому +5

    the code logic is easy but i couldnt approach the question ;)

  • @swarupdwivedy5733
    @swarupdwivedy5733 4 години тому +1

    Please start a playlist for Competative Programming

  • @imPriyansh77
    @imPriyansh77 5 годин тому +1

    I observed various permutations and combinations of strings and k values, and observed after 1-2 hours that if if number of odd freq characters > k, then k palindromes can't be made

  • @bhuppidhamii
    @bhuppidhamii 6 годин тому +3

    ऐसी की तैसी 😂

  • @harsh7512
    @harsh7512 6 годин тому +1

    bhaiya ye strings ke questions nahi hore kuch playlist wagera btaiye jahase chalu kr sake

  • @Tech_Explorer-d6g
    @Tech_Explorer-d6g 7 годин тому

  • @OtakRajCodes
    @OtakRajCodes 4 години тому

    Hi Mik , Thanks for the great explanation , but how do we solve this with brute force ?

  • @Tech_Explorer-d6g
    @Tech_Explorer-d6g 7 годин тому +1

    Hi Mazhar, I recently stumbled upon a video taking about Agentic AI and how it is gonna replace the future engineers, after watching the video I had few questions in my mind like as a fresher or beginner to coding is it worth learning dsa? or how can I be relevant to the IT industry .please address these kinda topics as well on your Instagram reels.

    • @codestorywithMIK
      @codestorywithMIK  28 хвилин тому

      Very good point. Let me elaborate to help you with this.
      DSA is the Foundation:
      As a fresher or beginner, learning Data Structures and Algorithms (DSA) is crucial. Most top companies like Meta, Google, Microsoft, and Amazon heavily emphasize DSA during the initial rounds of their hiring process. It helps you build problem-solving skills and logical thinking, which are the cornerstones of programming.
      Expand Beyond DSA:
      While DSA is essential, you should also focus on System Design and Object-Oriented Programming (OOPs) as you grow. These skills are critical for solving real-world problems and working on scalable projects.
      Learn Practical Skills:
      To stay relevant in the IT industry, it’s important to learn frameworks and tools that are widely used in development. For example:
      Spring Boot for backend development.
      React.js or Angular for frontend development.
      Databases (SQL and NoSQL) to manage and query data.
      Version Control (like Git) for collaborative coding.
      Embrace New Trends:
      AI and other emerging technologies are reshaping the industry. Instead of fearing them, use them to your advantage. For instance:
      Learn how to integrate AI tools into your projects.
      Use AI to automate repetitive tasks and enhance your productivity.
      Explore fields like Machine Learning, Data Science, or DevOps if they interest you.
      AI Can’t Replace Everything:
      AI might automate some repetitive tasks, but it can’t replace critical thinking, creativity, and problem-solving-skills that you’ll develop by learning DSA and working on real-world projects.
      In short, start with DSA to crack interviews and build a strong foundation. Then, gradually learn frameworks, tools, and trends like AI to grow your career. I’ll definitely create a reel on this topic soon to help others like you. Thanks for the suggestion! 🙌

  • @bhupendrakalal1727
    @bhupendrakalal1727 4 години тому +1

    bhaiya pata nhi kaise but 2 examples ka dry run kiya tha aur answer chamak gaya , same method , ab khud pr doubt ho raha h ki kaise kr liya🤣🤣

    • @gui-codes
      @gui-codes 33 хвилини тому

      🤣🤣🤣

  • @kartikgandhi7447
    @kartikgandhi7447 Годину тому

    **Approach-2: Using Bit Manipulation instead of frequency map**
    Code:
    class Solution {
    public:
    bool canConstruct(string& s, int k) {
    if(s.length() < k) return false;
    if(s.length() == k) return true;
    int n = s.length();
    // first 26 bits of freq variable is used to store frequencies
    int freq = 0;
    for(char& ch: s) {
    int pos = ch - 'a';
    // use xor to toggle bits, odd frequencies are always set to 1 and even to 0
    freq = (1 i) & 1) oddCnt++;
    }
    return oddCnt

    • @harshugamer7776
      @harshugamer7776 Годину тому

      how did you come up with that. like I kinda suck at bit manipulation can you give me some suggestions or recommendations...

  • @ReshuSharma-jc7yu
    @ReshuSharma-jc7yu 4 години тому

    Bhaiya i have got the intution of counting the characters and store it into hashmap but i was not able to to get the intution of s.length

  • @Muigoku49
    @Muigoku49 8 годин тому +5

    Bhai please continue dp concepts!!!

  • @ReshuSharma-jc7yu
    @ReshuSharma-jc7yu 4 години тому

    bhaiya can you all tell that how your logic building was improve how to improve it

  • @omanand8639
    @omanand8639 7 годин тому

    Please make a video on morris traversal and flattening binary tree into linked list i can't understand from any videos available on youtube bhaiya

    • @omanand8639
      @omanand8639 7 годин тому +1

      If possible please upload the video within upcoming week please bhaiya

    • @codestorywithMIK
      @codestorywithMIK  7 годин тому +2

      Morris Traversal - ua-cam.com/video/Wq3ibaP4dJY/v-deo.htmlsi=Tz-3rVL9K_aGv_CA
      😇❤️🙏

    • @codestorywithMIK
      @codestorywithMIK  7 годин тому +2

      Flattening Qn - ua-cam.com/video/NzXtnzQTouk/v-deo.htmlsi=BkguYRGK8O3vIumU
      ❤️😇🙏

    • @omanand8639
      @omanand8639 6 годин тому +1

      Awesome bhaiya you are great i was unable to find these video for that i am sorry 😂 you makes every concept very easy to implement thanks alot bhaiya❤

  • @krishyt20
    @krishyt20 8 годин тому

    par bhaiya question kuch alag sa tha
    mujhe toh thodi der lagi samaj ne me
    i was consfused like :
    agar "annabelle" each char. can make palindrome and it's => 9
    and it is not true, also we can make = "anna" , "elble" or "anbna" , "elle"
    then leetcode can can be true as well cause we can make some palindrome from it too
    but then i realised that we have to take every element while making palindrome
    and here it is
    code:
    class Solution {
    public:
    bool canConstruct(string s, int k) {
    int n = s.size();
    if(n < k) return false;
    if(n == k) return true;

    vector freq(26);
    int oddNum = 0;
    for(auto &ch : s) freq[ch - 'a']++;
    for(int i=0; i

  • @DevOpskagyaan
    @DevOpskagyaan 6 годин тому

    Aisi ki taisi 😂😂

  • @darkbgm4582
    @darkbgm4582 5 годин тому +2

    i solved this question by myself just in 5 minutes without watching ,thanks bhaiya
    class Solution {
    public:
    bool canConstruct(string s, int k) {
    if(s.size()

  • @ComputerCentre-rn2yy
    @ComputerCentre-rn2yy 4 години тому

    bro why so many add

  • @kartikforwork
    @kartikforwork 3 години тому

    sry for saying this but investing 40 min in a 20 min ques is needed? i thougth bhaiya aaj kuch naya padaege

  • @manpanpanman1015
    @manpanpanman1015 3 години тому

    why stop sharing ipad notes with videos

  • @Tech_Explorer-d6g
    @Tech_Explorer-d6g 7 годин тому +1

    Hi Mazhar, thanks for the video ❤
    I wanted to know your opinion about this video ua-cam.com/users/shortssMVWajWI4_Y
    How to be relevant in IT field like when I see this kinda video I feel like is it even worth learning all these dsa concept as a college student as in upcoming few years there will be no job.
    Please address this and it would be very helpful if you post tech trend and how to be relevant in industry kinda videos on your Instagram handle.
    Or reels like these which kinda scares freshers.

    • @codestorywithMIK
      @codestorywithMIK  27 хвилин тому

      DSA is the Foundation:
      As a fresher or beginner, learning Data Structures and Algorithms (DSA) is crucial. Most top companies like Meta, Google, Microsoft, and Amazon heavily emphasize DSA during the initial rounds of their hiring process. It helps you build problem-solving skills and logical thinking, which are the cornerstones of programming.
      Expand Beyond DSA:
      While DSA is essential, you should also focus on System Design and Object-Oriented Programming (OOPs) as you grow. These skills are critical for solving real-world problems and working on scalable projects.
      Learn Practical Skills:
      To stay relevant in the IT industry, it’s important to learn frameworks and tools that are widely used in development. For example:
      Spring Boot for backend development.
      React.js or Angular for frontend development.
      Databases (SQL and NoSQL) to manage and query data.
      Version Control (like Git) for collaborative coding.
      Embrace New Trends:
      AI and other emerging technologies are reshaping the industry. Instead of fearing them, use them to your advantage. For instance:
      Learn how to integrate AI tools into your projects.
      Use AI to automate repetitive tasks and enhance your productivity.
      Explore fields like Machine Learning, Data Science, or DevOps if they interest you.
      AI Can’t Replace Everything:
      AI might automate some repetitive tasks, but it can’t replace critical thinking, creativity, and problem-solving-skills that you’ll develop by learning DSA and working on real-world projects.
      In short, start with DSA to crack interviews and build a strong foundation. Then, gradually learn frameworks, tools, and trends like AI to grow your career. I’ll definitely create a reel on this topic soon to help others like you. Thanks for the suggestion! 🙌