troubleshooting Question

noX challenge

Avatar of gudii9
gudii9Flag for United States of America asked on
Java EEJavaProgrammingProgramming Languages-OtherSystem Programming
16 Comments2 Solutions414 ViewsLast Modified:

I am working on below challenge

Psedo code:
1. if array length is zero return ""
2. if array length is 1 and it is x return ""
3. if array length is 1 and it is not x return same str
4. else find location of x and replace with "" if greater than length
5. return replaced string

public String noX(String str) {
    return "";
    return "";
    return str;
    return str.replace("x","");
  return null;

I am passing all tests

How to improve/modify my design, code and any other alternate approaches. please advise
phoffricSoftware Engineering and Matlab Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 16 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros