Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void allPossibleWords(char C[][], int i, int j, int N, int M, char res[], int idx) {
- if (i > N || j > M) {
- return;
- }
- res[idx] = C[i][j];
- for (int l = 0; l <= idx; l++) {
- System.out.print(res[l]);
- }
- System.out.println();
- allPossibleWords(C, i + 1, j, N, M, res, idx + 1);
- allPossibleWords(C, i, j + 1, N, M, res, idx + 1);
- allPossibleWords(C, i + 1, j + 1, N, M, res, idx + 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement