we can note that we can do this question by taking out all unique strings from largest substring of unique char question and length*(length+1)/2 to find all susbtring because many susbtring we make will be repeated when we start from j+1 char se start hone walo ka count so we use count of end char/i jaha pr hai se count ,as repeatition nhi hoga as char pehle baar aah rha hai and we count all susbstring ending with that char
so basically ive written a code which is different , it passes on pepcoding portal but i cant find any other online judge which has this question so i cannot confirm whether this passes all testcases or not , so if anyone can provide me a testcase where this code fails please reply public static int solution(String str) { int i =0; int j =0; int count = 0; HashMap map = new HashMap(); while(i
C++ Much Concise and Easy to understand code using Set int minWindowCountSubstrings(string str) { int n = str.size(); int result = 0; int i = 0, j = 0; set set; while (j < n) { while (set.count(str[j]) != 0) { set.erase(str[i]); i++; } set.insert(str[j]); result += (int)set.size(); j++; } return result; }
Thank you so much. Helped me a lot in building my intuition. 🙏
Superb explanation!! Great teaching skills. Kudos to you!
This same code is not being submitted on pepcoding platform !! Giving WA for sample test case.
we can note that we can do this question by taking out all unique strings from largest substring of unique char question and length*(length+1)/2 to find all susbtring because many susbtring we make will be repeated when we start from j+1 char se start hone walo ka count
so we use count of end char/i jaha pr hai se count ,as repeatition nhi hoga as char pehle baar aah rha hai and we count all susbstring ending with that char
wonderful ..very very nicely explained ...superb ..you diserve 1 B views !!!
Thank you. You like this? Help us get the views.
ye to hogya tha one go me kaafi kraa die sir aap ne is type ke. to smjh aagya thi approach question pdh ke
Very good
Sir, I am a student of Subesh sir. Can you please start the course on system design also for experienced developers?
Soon
Thank you sir very much
Wow ..great explanation ❤️❤️
Glad you liked it.
For better experience and well organised content explore nados.pepcoding.com
instead of ans+=i-j ki jagah ans+=i-j+1 nhi hona chaiye ??
so basically ive written a code which is different , it passes on pepcoding portal but i cant find any other online judge which has this question so i cannot confirm whether this passes all testcases or not , so if anyone can provide me a testcase where this code fails please reply
public static int solution(String str) {
int i =0;
int j =0;
int count = 0;
HashMap map = new HashMap();
while(i
It does seems right
Request you to increase the frequency of your new videos!
I will try my best
Sir please level 1 pahle complete kardijiye
hanji 2 weeks mei kar dunga. thoda sa rehta hai wo
C++ Much Concise and Easy to understand code using Set
int minWindowCountSubstrings(string str) {
int n = str.size();
int result = 0;
int i = 0, j = 0;
set set;
while (j < n) {
while (set.count(str[j]) != 0) {
set.erase(str[i]);
i++;
}
set.insert(str[j]);
result += (int)set.size();
j++;
}
return result;
}
sir ye portal pe unlock kar dijiye
ji
u just taken "bc" 2 times in the above example
because both of them are different. first bc is from different index and the second one is from different index