DSA in java part 35

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ก.ย. 2024

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

  • @heymister3040
    @heymister3040 2 วันที่ผ่านมา +9

    Daily nee DSA videos kosam waiting lo untunna Macha, chaala baaga explain chesthunnav machaa 🤝🤝

  • @KARTHIKEYA-b7k
    @KARTHIKEYA-b7k 2 วันที่ผ่านมา +4

    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.

  • @jaswanthandhavarapu4325
    @jaswanthandhavarapu4325 2 วันที่ผ่านมา +2

    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

  • @TarunKumarTadala
    @TarunKumarTadala 2 วันที่ผ่านมา +1

    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;
    }
    }

  • @KarthikNaga-b2i
    @KarthikNaga-b2i 18 ชั่วโมงที่ผ่านมา

    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;
    }
    }

  • @nithinchinthareddy
    @nithinchinthareddy 2 วันที่ผ่านมา +2

    bro daily video Apply cheyava please

  • @villageshortvideos4435
    @villageshortvideos4435 2 วันที่ผ่านมา

    Super bro complete fastly

  • @LohithaYerragudi
    @LohithaYerragudi วันที่ผ่านมา

    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)

  • @maneesha5182
    @maneesha5182 2 วันที่ผ่านมา

    Make more videos on dp,graphs

  • @lavan1119
    @lavan1119 2 วันที่ผ่านมา

    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;

    }
    }

  • @Chintapakdamdam-e3d
    @Chintapakdamdam-e3d 2 วันที่ผ่านมา

    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

    • @lavan1119
      @lavan1119 2 วันที่ผ่านมา

      lmao we used the same approach

  • @studydepartment2489
    @studydepartment2489 2 วันที่ผ่านมา +1

    Bro program name mention cheyu

  • @1min-crafts991
    @1min-crafts991 2 วันที่ผ่านมา

    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💀