MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / subSequence

Method subSequence

StringSubsequences.java:9–30  ·  view source on GitHub ↗
(String input, String output, int index)

Source from the content-addressed store, hash-verified

7 }
8
9 public static void subSequence(String input, String output, int index)
10 {
11
12 // Base Case
13 if(index>=input.length())
14 {
15 for(int i=0;i<output.length();i++)
16 {
17 System.out.print(output.charAt(i)+" ");
18 }
19 System.out.println();
20 return;
21 }
22
23 // including element
24 output=output+input.charAt(index);
25 subSequence(input,output,index+1);
26
27 // excluding element
28 output=output.substring(0,output.length()-1);
29 subSequence(input,output,index+1);
30 }
31
32}

Callers 1

mainMethod · 0.95

Calls 1

printMethod · 0.80

Tested by

no test coverage detected