Word Subsets | Simple Thought Process | C++ | Java | Leetcode 916 | codestorywithMIK

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ม.ค. 2025

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

  • @shreyaawasthi7958
    @shreyaawasthi7958 8 ชั่วโมงที่ผ่านมา +11

    Good morning Sir,
    Tomorrow's Motivation from my side :- Consistency and discipline are the bridges between goals and accomplishments.

    • @unknown47896
      @unknown47896 6 ชั่วโมงที่ผ่านมา +2

      nice one shreya ji

    • @souravjoshi2293
      @souravjoshi2293 5 ชั่วโมงที่ผ่านมา

      nice

  • @gui-codes
    @gui-codes 8 ชั่วโมงที่ผ่านมา +9

    Thanks a lot for JAVA code.
    I got stuck in the max frequency part, as soon as you explained "oo" wala case, it triggered me and solved it immediately. Thanks a lot

  • @italk-gj5kk
    @italk-gj5kk 9 ชั่วโมงที่ผ่านมา +14

    Thanks a lot for bringing Java code ❤❤

  • @EB-ot8uu
    @EB-ot8uu 5 ชั่วโมงที่ผ่านมา +2

    9:04 me video pause kiya and sab samajh agaya and coded it.
    Beautifully explained. You have proved that you are the best tutor of DSA on youtube

  • @indianengineer5802
    @indianengineer5802 8 ชั่วโมงที่ผ่านมา +6

    thanks for java code mik

  • @jain5184
    @jain5184 10 ชั่วโมงที่ผ่านมา +7

    Chalo
    Kaam pr chalta hai mik bhaiya agar consistent hai toh hum kuu nhi

  • @wearevacationuncoverers
    @wearevacationuncoverers 5 ชั่วโมงที่ผ่านมา

    80K soon. Congratulations in advance. Soon you will hit Millions. You are doing an amazing work.

  • @souravjoshi2293
    @souravjoshi2293 5 ชั่วโมงที่ผ่านมา

    crystal clear sir

  • @zaffarzeshan1308
    @zaffarzeshan1308 4 ชั่วโมงที่ผ่านมา +1

    thank u for java imam bhai

  • @vaibhav454
    @vaibhav454 5 ชั่วโมงที่ผ่านมา +2

    Motivation- Days are Foggy but Don't be lazy like Doggy 👌👌👌👌

  • @maniBrave
    @maniBrave 4 ชั่วโมงที่ผ่านมา +1

    thanks for coding in java

  • @KushalAgrawal-d5b
    @KushalAgrawal-d5b 8 ชั่วโมงที่ผ่านมา +4

    thnx for java code

  • @ConvxO2
    @ConvxO2 4 ชั่วโมงที่ผ่านมา

    Hello MIK, kindly make a video on "Meet in the middle" algorithm

  • @RohitKumar-kj3yl
    @RohitKumar-kj3yl 7 ชั่วโมงที่ผ่านมา +5

    bhai bhai

  • @gorasiyakashyap695
    @gorasiyakashyap695 9 ชั่วโมงที่ผ่านมา +6

    I’m asking about the interview and placement perspective for company.
    Bhaiya, I am a C++ and Python coder. I know Java at a basic to medium level but am not able to use it for competitive coding. Is it necessary for me to learn Java more for coding as well? Personally, I hate writing programs in Java. It was a subject in my BTech, so I’ve done it, but nothing more than that.
    and can you bring video like " programming lang. and other tools/software and it's usecases in IT industry ". in detail.
    Please Request
    Thank you ❤🙏

    • @gui-codes
      @gui-codes 8 ชั่วโมงที่ผ่านมา +1

      nahi bhai, java is not mandatory for competitive coding ,you can use c++

    • @codestorywithMIK
      @codestorywithMIK  7 ชั่วโมงที่ผ่านมา +9

      If you're comfortable with C++ and Python, you can continue with them. Most companies allow coding in any language during interviews.
      While deep knowledge of Java isn't mandatory, understanding its basics (OOP, Collections, Exception Handling) is helpful for industry use, especially in backend development or Spring Boot projects.
      For competitive programming or interviews, focus on C++ and Python if they are your strong suits.
      I love your suggestion about creating a video on "Programming Languages and Tools in the IT Industry." I’ll definitely consider making a detailed video very soon.
      Thank you 🙂

    • @gorasiyakashyap695
      @gorasiyakashyap695 6 ชั่วโมงที่ผ่านมา +1

      @@codestorywithMIK thank you so much 🙏

  • @shaiksameerbasha4702
    @shaiksameerbasha4702 6 ชั่วโมงที่ผ่านมา +1

    Only consistency transforms Average into Excellence..

  • @sauravchandra10
    @sauravchandra10 3 ชั่วโมงที่ผ่านมา +1

    Python implementation:
    class Solution:
    def wordSubsets(self, words1: List[str], words2: List[str]) -> List[str]:
    reqFreq = [0]*26
    for word in words2:
    cur = Counter(word)
    for i in range(26):
    if chr(i+ord('a')) in cur:
    reqFreq[i] = max(reqFreq[i], cur[chr(i+ord('a'))])
    res = []
    for word in words1:
    curCounter = Counter(word)
    possible = True
    for i in range(26):
    if reqFreq[i] == 0:
    continue

    if (
    chr(i+ord('a')) not in curCounter or
    curCounter[chr(i+ord('a'))] < reqFreq[i]
    ):
    possible = False
    continue
    if possible:
    res.append(word)
    return res

  • @vishwashsoni610
    @vishwashsoni610 9 ชั่วโมงที่ผ่านมา +5

    this is how i solved this question sir :
    class Solution {
    public:
    bool check(vector& mp1,vector& mp2){
    for(int i=0;i

  • @AkashKumar62000
    @AkashKumar62000 7 ชั่วโมงที่ผ่านมา

    bhaiya aasa he java me bhi solution batya kariya c++ ke sath sath..🙏🏻🙏🏻🙏🏻

  • @dayashankarlakhotia4943
    @dayashankarlakhotia4943 10 ชั่วโมงที่ผ่านมา +8

    First

  • @KG-ts2cz
    @KG-ts2cz 9 ชั่วโมงที่ผ่านมา +5

    Hello MIK,
    I really need your advise. I am going to appear in the fourth and final round of a big tech mnc. The feedback that I received from the previous three rounds was that I eventually come up with approach and code, but was not able to handle edge cases and corner cases. I have roughly 4-5 days left to prepare. Could be please suggest a strategy of what and how to prepare in this final stage. I am following your channel from past 1 year. Any advise would be much appreciated🙏🙏🙏

    • @codestorywithMIK
      @codestorywithMIK  7 ชั่วโมงที่ผ่านมา +5

      Hi there, Congratulations on making it to the final round.
      Here’s a quick strategy for the next 4-5 days :
      Focus on Edge Cases :
      Example :
      For Arrays: edge case would be like Empty check, single-element in array, does it have duplicates, Array is sorted/unsorted.
      Strings: edge case would be like Empty check, single character in string, repetitive patterns present in the string.
      Graphs: Check or ask them if graph is Disconnected/Connected, will have cycles or not , single-node edge case
      I usually ask myself worst scenario that could break this logic ?
      Test for extreme values, invalid inputs, and constraints (largest test case, smallest test case etc).
      Most importantly, ask the interviewer you want to do the Dry Run of Code :
      Trace manually with edge cases before running.
      Focus on quality over quantity. Explain in Interviews, explicitly talk and mention about edge cases while explaining your approach. Stay Calm and confident, silently listen to what the interviewer is saying, never interrupt them,
      and yes, Missing an edge case is okay if you quickly debug and fix it.
      All the best ! Let me know how it goes.

    • @KG-ts2cz
      @KG-ts2cz 7 ชั่วโมงที่ผ่านมา +1

      @@codestorywithMIK Thank you so much MIK. I am a bit underconfident because of how the previous rounds went. I felt like I was struggling at many places, and could feel the pressure build up in the round.

    • @codestorywithMIK
      @codestorywithMIK  7 ชั่วโมงที่ผ่านมา +2

      @KG-ts2cz that’s natural. It happens with everyone during interviews. Don’t worry, you got this ❤️

  • @bhuppidhamii
    @bhuppidhamii 9 ชั่วโมงที่ผ่านมา +7

    I was not able to understand the eg test cases 😢

    • @gui-codes
      @gui-codes 8 ชั่วโมงที่ผ่านมา +1

      problem statement bekar tha as MIK also mentioned in the video.

    • @codestorywithMIK
      @codestorywithMIK  8 ชั่วโมงที่ผ่านมา +7

      Don't worry. Leetcode had bad problem statement for this problem.

  • @Cgarg2306
    @Cgarg2306 23 นาทีที่ผ่านมา

    Bhaiya Median in a row-wise sorted Matrix iss question par video try karo please

  • @manpanpanman1015
    @manpanpanman1015 5 ชั่วโมงที่ผ่านมา

    Sir can we solve this question using Trie , by inputting all words in word1 then search word2 alphabets in trie using and where condition satisfied store them in separate vector though TC and SC will be high and not optimal solution

  • @ayushvermaverma4561
    @ayushvermaverma4561 4 ชั่วโมงที่ผ่านมา

    one doubt : assume maxf[i]=10 and charfreq [i]=10then it mean both have equal on of char and it pass given criteria

  • @adityatiwari7058
    @adityatiwari7058 6 ชั่วโมงที่ผ่านมา

    question me subset bola hai but order is ignored description is misleading

  • @vaibhav454
    @vaibhav454 4 ชั่วโมงที่ผ่านมา

    Freq alone CANNOT guarantee the subsequence... bcoz it is not mandatory that it will take care of relative order of the words .... Ex- if we need to search for 'wrr' but string is 'rawr' we cannot say it as subsequence ?????

    • @gui-codes
      @gui-codes 3 ชั่วโมงที่ผ่านมา +1

      I was also confused from the problem statement. But it stated in the beginning about how they have defined subset - A string b is a subset of string a if every letter in b occurs in a including multiplicity.
      Here as per the problem's description of subset, it doesn't matter what the relative order is, it only cares about the character and frequency.
      I did not like this problem's description.

  • @harshvardhanshinde7343
    @harshvardhanshinde7343 6 ชั่วโมงที่ผ่านมา

    why this is not correct ?
    class Solution {
    public:
    vector wordSubsets(vector& words1, vector& words2) {
    int m = words2.size(), n = words1.size();
    vector vec(n);
    for (int i = 0; i < n; i++) {
    int count=0;
    for (int j = 0; j < m; j++) {
    if(words1[i].find(words2[j])==string::npos){
    count++;
    break;
    }
    }
    if(count==0)vec.push_back(words1[i]);
    }
    return vec;
    }
    };

  • @satyasagarpatel9384
    @satyasagarpatel9384 ชั่วโมงที่ผ่านมา

    vector wordSubsets(vector& words1, vector& words2) {
    vector res;
    int n=words1.size();
    int m=words2.size();
    for(int i=0;i

  • @monugit9
    @monugit9 5 ชั่วโมงที่ผ่านมา

    Thnx for java code