Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

a error in java program,plz tell me error/

$
0
0

class a {

    public static void main ( String args[] ) {

            char[] combos = new char[args[0].length()];
            findCombos ( args[0], new String(combos), 0 );

    }



    private static void findCombos( String str, String combos, int index ) {

            char[] comboChars = combos.toCharArray();


            if ( index == str.length()) {

                    System.out.println( new String(comboChars) );

                    return;

            }

            for ( int i = 0; i < str.length(); i++ ) {
                    char[] strChars = str.toCharArray();
                    comboChars[index] = strChars[i];
                    index++;
                    findCombos(str, new String(comboChars), index);
                    index--;

            }




    }

}


Viewing all articles
Browse latest Browse all 40121

Trending Articles