Hi, can you please make videos covering more dsa topics. It will be very helpful. I am following your dsa playlist and learning a lot from there. Thank you 😊
@sreelakshmi.s2445 Жыл бұрын
Good explanation sir. Understood well. Was looking solution for this problem, This is the best video i found. Thank you... But here time complexity would not be o(n)
@tanishdogra88158 ай бұрын
Yes
@vaishnaviuttarwar1597 Жыл бұрын
Hello, can’t we solve it by sliding window method?
@na8884 Жыл бұрын
*)Subarray division public class BubbleSortExample { static int bubbleSort(int[] arr,int d,int m) { int n=arr.length; int count=0; for(int i=0; i < n+1-m; i++) { int sum =0; for(int j=i; j < i+m; j++){ sum=sum+arr[j]; // System.out.print(n1); } if(sum==d) { count++; } } return count; } public static void main(String[] args) { int arr[] ={2,2,1,3,2,2}; System.out.println("Array Before Bubble Sort"); for(int i=0; i < arr.length; i++){ // System.out.print(arr[i] + " "); } System.out.println(bubbleSort(arr,4,2)); } }