Answers for "how to find the possible combination of all elements in the array"

0

combinations in java

private void helper(List<int[]> combinations, int data[], int start, int end, int index) {    
  if (index == data.length) {        
    int[] combination = data.clone();        
    combinations.add(combination);    
  } 
  else if (start <= end) {        
    data[index] = start;        
    helper(combinations, data, start + 1, end, index + 1);        
    helper(combinations, data, start + 1, end, index);    
  }
}
Posted by: Guest on November-25-2020

Code answers related to "how to find the possible combination of all elements in the array"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language