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.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. Algorithms
  3. Strings
  4. Gemstones
  5. Discussions

Gemstones

Problem
Submissions
Leaderboard
Discussions
Editorial
Topics

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

  • ace_dexter 5 years ago+ 0 comments

    Have a close look at it:

    "if (letter[c - 'a'] == r) { letter[c - 'a']++; "

    If repeated character is met, this 'if' condition will fail because at first, if condition is passed but after it the letter[c - 'a'] is incremented, but the r's value is still same say '0' for 1st iteration then letter[c - 'a'] will be 1 which leads to failing of this 'if' case for 2nd iteration.

    1|
    ParentPermalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature