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
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 ❤🙏
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 🙂
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
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🙏🙏🙏
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.
@@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.
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
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 ?????
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.
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; } };
Good morning Sir,
Tomorrow's Motivation from my side :- Consistency and discipline are the bridges between goals and accomplishments.
nice one shreya ji
nice
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
Thanks a lot for bringing Java code ❤❤
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
thanks for java code mik
Chalo
Kaam pr chalta hai mik bhaiya agar consistent hai toh hum kuu nhi
80K soon. Congratulations in advance. Soon you will hit Millions. You are doing an amazing work.
crystal clear sir
thank u for java imam bhai
Motivation- Days are Foggy but Don't be lazy like Doggy 👌👌👌👌
thanks for coding in java
thnx for java code
Hello MIK, kindly make a video on "Meet in the middle" algorithm
bhai bhai
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 ❤🙏
nahi bhai, java is not mandatory for competitive coding ,you can use c++
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 🙂
@@codestorywithMIK thank you so much 🙏
Only consistency transforms Average into Excellence..
Indeed ❤️
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
this is how i solved this question sir :
class Solution {
public:
bool check(vector& mp1,vector& mp2){
for(int i=0;i
well done
@@codestorywithMIK
bhaiya aasa he java me bhi solution batya kariya c++ ke sath sath..🙏🏻🙏🏻🙏🏻
First
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🙏🙏🙏
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.
@@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.
@KG-ts2cz that’s natural. It happens with everyone during interviews. Don’t worry, you got this ❤️
I was not able to understand the eg test cases 😢
problem statement bekar tha as MIK also mentioned in the video.
Don't worry. Leetcode had bad problem statement for this problem.
Bhaiya Median in a row-wise sorted Matrix iss question par video try karo please
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
one doubt : assume maxf[i]=10 and charfreq [i]=10then it mean both have equal on of char and it pass given criteria
question me subset bola hai but order is ignored description is misleading
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 ?????
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.
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;
}
};
vector wordSubsets(vector& words1, vector& words2) {
vector res;
int n=words1.size();
int m=words2.size();
for(int i=0;i
Thnx for java code