Java > Recursion-1 > NoX (CodingBat Solution)
Maybe your like
Java > Recursion-1 > noX (CodingBat Solution)
Problem:
Given a string, compute recursively a new string where all the 'x' chars have been removed. noX("xaxb") → "ab" noX("abc") → "abc" noX("xx") → ""
Solution:
public String noX(String str) { if (str.equals("")) return str; if (str.charAt(0) == 'x') return noX(str.substring(1)); else return str.charAt(0) + noX(str.substring(1)); } Labels: codingbat , intermediate , recursion2 comments :
AnonymousNovember 17, 2017 at 5:36 AMpublic String noX(String str) { int i = str.indexOf('x'); if(i==-1)return str; str = str.substring(0,i)+str.substring(i+1); return noX(str);}
ReplyDeleteReplies- Reply
UnknownSeptember 16, 2020 at 8:27 PMpublic String noX(String str) { if(str.indexOf("x")<0) return str; return noX(str.substring(0, str.indexOf("x")) + str.substring(str.indexOf("x")+1));}
ReplyDeleteReplies- Reply
Search This Site
Sponsored Links
Follow Me
If you like our content, feel free to follow me to stay updated.
Subscribe
Enter your email address:
We hate spam as much as you do.
Upload Material
Got an exam, project, tutorial video, exercise, solutions, unsolved problem, question, solution manual? We are open to any coding material. Why not upload?Upload
Copyright © 2012 - 2014 Java Problems -- About -- Attribution -- Privacy Policy -- Terms of Use -- ContactTag » Codingbat Nox Solution
-
Codingbat-solutions/noX.java At Master - GitHub
-
Recursion - 1 (noX) Java Solution || - YouTube
-
Functional-1 (noX) Java Tutorial || - YouTube
-
CodingBat Java Recursion-1 NoX
-
CodingBat Java Functional-1 NoX
-
Functional – 1 - Dev-wannabe
-
Recursion-1 - Coding Bat Answers
-
CodingBat: Java. Recursion-1, Part II - Gregor Ulm
-
String - Coding Bat Recursion Exercise (java) - Stack Overflow
-
Solved: NoX Functional Program - Experts Exchange
-
Coding Bat Related Recursion Exercises (Due 18 Apr 2014)
-
CodingJS
-
Codingbat-java-recursion-1 - 30 Probs Flashcards | Quizlet
Anonymous
Unknown