Guest User

Untitled

a guest
Dec 17th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public class largestSubArray
  2. {
  3. static int arr[] = new int[]{1, 0, 1, 0, 0, 1, 0};
  4.  
  5. static void subArray( int n)
  6. {
  7. for (int i=0; i <n; i++)
  8. {
  9. for (int j=i; j<n; j++)
  10. {
  11. for (int k=i; k<=j; k++)
  12. System.out.print(arr[k]+" ");
  13. }
  14. }
  15. }
  16.  
  17. public static void main(String[] args)
  18. {
  19. System.out.println("All Non-empty Subarrays");
  20. subArray(arr.length);
  21.  
  22. }
  23.  
  24. }
Add Comment
Please, Sign In to add comment