We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 791394d commit f98984eCopy full SHA for f98984e
Course 2 - Data Structures in JAVA/Recursion Assignment/String to Integer
@@ -23,3 +23,19 @@ Sample Output 2 :
23
12567
24
*/
25
26
+public class solution {
27
+
28
+ public static int convertStringToInt(String input){
29
+ // Write your code here
30
+ if (input.length()==0)
31
+ {
32
+ return 0;
33
+ }
34
+ int smallOutput=convertStringToInt(input.substring(0,input.length()-1));
35
+ int val=(int)input.charAt(input.length()-1);
36
+ val=(val-48);
37
+ //System.out.println(val);
38
+ return (val)+(smallOutput*10);
39
40
41
+}
0 commit comments