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. Highest Value Palindrome
  5. Discussions

Highest Value Palindrome

Problem
Submissions
Leaderboard
Discussions
Editorial

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

  • hoang_huy_tran01
    5 months ago+ 0 comments

    Hey guys,

    I just found an improvement which can be made to the editorial.

    The solution in editorial doesn't cover the case that maximise the smallest palindrome element first. Apparently it maximises the value from left to right.

    Try this edge case to see what I mean: s = '81118' k = 2

    the highest value palindrome is 89198 with 2 changes. However the solution outputs 91119.

    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy