We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f98984e commit 176ee36Copy full SHA for 176ee36
Course 2 - Data Structures in JAVA/Recursion Assignment/Pair Star
@@ -21,3 +21,26 @@ aaaa
21
Sample Output 2 :
22
a*a*a*a
23
*/
24
+
25
+public class solution {
26
27
+ // Return the updated string
28
+ public static String addStars(String s) {
29
+ // Write your code here
30
+ if (s.length()==1)
31
+ {
32
+ return s;
33
+ }
34
+ if (s.charAt(0)==s.charAt(1))
35
36
+ String smallOutput=addStars(s.substring(1));
37
+ return s.charAt(0)+"*"+smallOutput;
38
39
+ else
40
41
42
+ return s.charAt(0)+smallOutput;
43
44
45
46
+}
0 commit comments