Awesome bruh. Able to solve many questions which previously can't. One request just continue it every day if possible increase no.of lectures or duration. I understand you have a lot of other work too. Great respect for that.
public class Main { public static void main(String[] args) { int[] arr = {1,0,1,1,0,0}; int k = 2; int l = 0; int count_ones = 0; int count_zeros = 0; int ans = 0; for(int r = 0; rk) { if(arr[l] == 0) { count_zeros--; } else{ count_ones--; } l++; } ans = Math.max(ans,count_ones+count_zeros); } System.out.println(ans); } } time taken 43 mins class Solution { public int maxConsecutiveAnswers(String answerKey, int k) { int ans = 0; int l = 0; int count_t = 0; int count_f = 0; for(int r = 0; rk) { if(answerKey.charAt(l) == 'T') count_t--; else count_f--; l++; } ans = Math.max(ans,count_t+count_f); } return ans; } } time taken 15 mins
class Solution { public int maxConsecutiveAnswers(String answerKey, int k) { int n = answerKey.length(); int left = 0; int cF = 0; int cT = 0; int max = 0; for(int r=0; r k){ char ch1 = answerKey.charAt(left); if(ch1 == 'F'){ cF--; }else{ cT--; } left++; }
max = Math.max(max,r - left +1); } return max; } }
class Solution { public int maxConsecutiveAnswers(String answerKey, int k) { int n=answerKey.length(); int l=0; int cnt0=0; int cnt1=0; int ans=0; for(int r=0;rk){ if(answerKey.charAt(l)=='F'){ cnt0--; }else{ cnt1--; } l++; } ans=Math.max(ans,r-l+1); } return ans; } }
class Solution { public int maxConsecutiveAnswers(String answerKey, int k) { int tCnt=0; int fCnt=0; int l=0; int maxconseqLen=0; for(int r=0;r k){ if(answerKey.charAt(l) =='T'){ tCnt-=1; } else{ fCnt-=1; } l++; } if(Math.min(tCnt,fCnt)
class Solution { public int maxConsecutiveAnswers(String answerKey, int k) { int l=0; int temp=0; int temp1=0; int ans=0; for(int r=0;rk){ if(answerKey.charAt(l)=='T'){ temp--; } else{ temp1--; } l++; } ans= Math.max(ans,r-l+1);
class Solution { public int maxConsecutiveAnswers(String answerKey, int k) { int l=0; int temp=0; int ans=0; int temp1=0; int ans1=0; for(int r=0;rk && temp1>k){ if(answerKey.charAt(l)=='T'){ temp--; } else{ temp1--; } l++; } ans=Math.max(ans,r-l+1); } return ans; } } Bro l got it before ur explaination......tq so muchhh
Daily nee DSA videos kosam waiting lo untunna Macha, chaala baaga explain chesthunnav machaa 🤝🤝
Awesome bruh. Able to solve many questions which previously can't. One request just continue it every day if possible increase no.of lectures or duration. I understand you have a lot of other work too. Great respect for that.
public class Main
{
public static void main(String[] args) {
int[] arr = {1,0,1,1,0,0};
int k = 2;
int l = 0;
int count_ones = 0;
int count_zeros = 0;
int ans = 0;
for(int r = 0; rk) {
if(arr[l] == 0) {
count_zeros--;
}
else{
count_ones--;
}
l++;
}
ans = Math.max(ans,count_ones+count_zeros);
}
System.out.println(ans);
}
}
time taken 43 mins
class Solution {
public int maxConsecutiveAnswers(String answerKey, int k) {
int ans = 0;
int l = 0;
int count_t = 0;
int count_f = 0;
for(int r = 0; rk) {
if(answerKey.charAt(l) == 'T') count_t--;
else count_f--;
l++;
}
ans = Math.max(ans,count_t+count_f);
}
return ans;
}
}
time taken 15 mins
class Solution {
public int maxConsecutiveAnswers(String answerKey, int k) {
int n = answerKey.length();
int left = 0;
int cF = 0;
int cT = 0;
int max = 0;
for(int r=0; r k){
char ch1 = answerKey.charAt(left);
if(ch1 == 'F'){
cF--;
}else{
cT--;
}
left++;
}
max = Math.max(max,r - left +1);
}
return max;
}
}
class Solution {
public int maxConsecutiveAnswers(String answerKey, int k) {
int n=answerKey.length();
int l=0;
int cnt0=0;
int cnt1=0;
int ans=0;
for(int r=0;rk){
if(answerKey.charAt(l)=='F'){
cnt0--;
}else{
cnt1--;
}
l++;
}
ans=Math.max(ans,r-l+1);
}
return ans;
}
}
bro daily video Apply cheyava please
Super bro complete fastly
class Solution {
public int maxConsecutiveAnswers(String answerKey, int k) {
int tCnt=0;
int fCnt=0;
int l=0;
int maxconseqLen=0;
for(int r=0;r k){
if(answerKey.charAt(l) =='T'){
tCnt-=1;
}
else{
fCnt-=1;
}
l++;
}
if(Math.min(tCnt,fCnt)
Make more videos on dp,graphs
class Solution {
public int maxConsecutiveAnswers(String answerKey, int k) {
int l=0;
int temp=0;
int temp1=0;
int ans=0;
for(int r=0;rk){
if(answerKey.charAt(l)=='T'){
temp--;
}
else{
temp1--;
}
l++;
}
ans= Math.max(ans,r-l+1);
}
return ans;
}
}
class Solution {
public int maxConsecutiveAnswers(String answerKey, int k) {
int l=0;
int temp=0;
int ans=0;
int temp1=0;
int ans1=0;
for(int r=0;rk && temp1>k){
if(answerKey.charAt(l)=='T'){
temp--;
}
else{
temp1--;
}
l++;
}
ans=Math.max(ans,r-l+1);
}
return ans;
}
}
Bro l got it before ur explaination......tq so muchhh
lmao we used the same approach
Bro program name mention cheyu
One day one guy comment you and a girl laughed at you Now she is your subscriber or follower and she asking for next DSA video when💀