private void permuteHelper(int[] num, int left){
        if(left == num.length -1){
            ArrayList<Integer> list = new ArrayList<Integer>();
            for(int i=0; i<num.length; i++){
                list.add(num[i]);
            }
            result.add(list);
            return;
        }
        
        for(int right=left; right<num.length; right++){
            swap(num, left, right);
            permuteHelper(num, left+1);
            swap(num, left, right);
        }
    }