We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Strings
  4. Super Reduced String
  5. Discussions

Super Reduced String

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • 13yae13
    2 months ago+ 0 comments

    Java solution:

    public static String superReducedString(String s) {
        while (s != (s = s.replaceAll("([a-z])\\1{1,1}", ""))){}
        return s.isEmpty()? "Empty String" : s;
    }
    
    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy