java - Time complexity of given code ?subarray sum -
public static void print(int arr[],string s,int j,int sum,int num){ if(num==sum&&s.length()==6){ system.out.println(s.substring(1)); } if(j==arr.length){ return; } for(int i=j;i<arr.length;i++){ print(arr, s+" "+arr[i], i+1, sum+arr[i], num); } } public static void findtriplet(int[] arr, int x){ print(arr, "", 0, 0,x);
} find time complexity of code, question find subarray of given array sum k can have duplicates values
Comments
Post a Comment