You are not logged in. Please login at to post your questions!


Need help regarding CHDIGER

I am trying to solve Chef and a Beautiful Digit From March Long challenge. I have tried implementing it but am not able to get why I am getting the wrong answer. I have tried it for many input but I am getting correct for all the input. It would be great if someone could tell me what I am missing. Attached the link to my code.

asked 13 Mar, 19:10

snami_01's gravatar image

accept rate: 0%

Hi!!Could you please describe what your logic is and what exactly your code is doing??. or add comments in between your code to show what each step is doing??.

One Test case i found where your solution fails is the following


423234 6

Your Answer - 223666

Correct Answer - 223466

Hope This Helps!!. :)


answered 13 Mar, 20:06

lonewolf_kj's gravatar image

accept rate: 25%

edited 13 Mar, 20:07


Got it. Thanks a lot for the help.

(14 Mar, 13:07) snami_012★

Dude, The correct output would be 223366


answered 13 Mar, 21:22

shivam3211's gravatar image

accept rate: 0%


The correct answer would 223466 only. You are only to append a digit and then remove a digit from any place. So you cannot shift the digits.

Thus to have 2nd digit as "2", The first 3 needs to be removed. Also since 4<6 There is no need to remove 4. Thus the minimum number that can be obtained turns out to be 223466.

(223366 > 223346, and both 223366 and 223346 cannot be obtained by only appending and removing a digit.)


answered 14 Mar, 02:07

lonewolf_kj's gravatar image

accept rate: 25%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 13 Mar, 19:10

question was seen: 82 times

last updated: 14 Mar, 13:07