variable size sliding window | part 32 | DSA in java in telugu | Engineering Animuthyam
ฝัง
- เผยแพร่เมื่อ 30 ก.ย. 2024
- Free Java dsa course in Telugu | Engineering Animuthyam
Free Java dsa course in Telugu
Website link:
vigneshreddyjulakanti.in
Insta:
Engineering Animuthyam
Dsa in telugu
from scratch
easy
hd
simple
telugu engineering
dsa
coding
programming
engineering
engineering animuthyam.
jobs
high paying jobs
road maps
Dsa in telugu
Mern stack
Python
Java
M1
Daa
Placements
Btech
IIt
Nit
Eamcet
#coding #telugu #job #python #telugumemes #trendingreels #btech #college #java #javacoding #iit
#nit #jee #eamcet #dsa
Ardamavutundi bro bane....kani starting konchem confuse avutunna but meru explain chesaka all clear
tq so much bro
bruh,
Ee course motham entha duration undochuu,oka estimation cheptava pls..
PDF website lo upload cheyy macha
Hi
Very happy to see your videos..and one more request form viewer side is,you develop one web set that show notes,links all these.please explain it.we did what you done in your video.we thought that I am good coder ,but so many candidates enable implement in our daily life as you used .
Hi bro please give assignments and update codes section in your website
Thank you so much Macha 🤝
Really good teaching🎉❤
without while loop ? ela undhi anna
l=0
temp=0
ans=0
for r in range(len(x)):
if x[r]==1:
temp=temp+1
if temp==3 :
if x[l]==1:
temp=temp-1
l=l+1
if temp==2:
ans=max(ans,r-l+1)
print(ans)
class HelloWorld {
public static void main(String[] args) {
int ar[] = {1,1,2,1,3,1};
int l = 0;
int count = 0;
int ans = 0;
for(int r=0;r2){
if(ar[l]==1){
count--;
}
l++;
}
if(count==2){
ans= Math.max(ans,(r-l+1));
}
}
System.out.println(ans);
}
}
macha ni code k = 1 one test case daggara fail avutundhi emi chinna modify chesa almost kada so nenu minimum 2 ones vundali sub array lo so
public class Main {
public static void main(String[] args) {
int[] arr = {0, 1, 3, 1, 1, 6, 7, 1, 0, 1};
int k = 2; // no of max one should be in one sub Array
int l = 0;
int ans = 0;
int count_ones = 0;
for(int r = 0; r= k) {
ans = Math.max(ans,r - l + 1);
if(arr[l] == 1 ) {
count_ones--;
}
l++;
}
}
System.out.println(ans);
}
nenu anukuntundhi correct anukutuna wrong aithe reply cheyandi correct chesukunta
Ans ni while loop lo update cheyaku macha . Last lo update nen chesnatu so ani pass aythai ani questions same code vadutham manam
Edi try chesa machaa , but edi cheyadaniki more than 30 min pattindi. Chala thnxs macha, mee explanation vale nen problems try cheyagalgutuna.
class HelloWorld {
public static void main(String[] args) {
int[] arr={0,1,3,10,10,6,7,1,9,1};
int maxLen =0;
int count=0;
int l=0;
int k=2;
for(int r=0;rk){
if(arr[l]==1){
count--;
}
l++;
}
if(count==k){
int len=r-l+1;
maxLen=Math.max(len,maxLen);
}
}
System.out.println(maxLen);
}
}
notes update cheyii macha....
sorry ,meru chesina browser
package TwoPointers;
import java.util.*;
public class AtmostKNumberOfOnes {
public static void check(int[] arr, int k) {
int n = arr.length;
int count = 0;
int ans = 0;
int l = 0;
for (int r = 0; r < n; r++) {
if (arr[r] == 1) {
count++;
}
while (count > k) {
if (arr[l] == 1) {
count--;
}
l++;
}
ans = Math.max(ans, r - l + 1);
}
System.out.println(ans);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
int k = sc.nextInt();
check(arr, k);
}
}