My solution works on Eclipse but not OJ

  • 0
    public static List<List<Integer>> permute(int[] nums) {
     if(nums == null || nums.length == 0) return result;
     // turns into a list
     ArrayList<Integer> list = new ArrayList();
     for(int i: nums) list.add(i);
     permuteHelper(list, 0);
     return result;}
     public static void permuteHelper(ArrayList<Integer> list, int start){
     if(start >= list.size()){
    	 result.add(new ArrayList(list));
     HashSet<Integer> visited = new HashSet();
     for(int i=start; i<list.size(); i++){
    	 permuteHelper(list, start+1);

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.