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

×

How to minimize a string.Cook 56

http://www.codechef.com/viewsolution/6570234 Can anyone please explain where my solution is failing. I can't figure it out myself.

asked 23 Mar '15, 11:57

priyanjitdey94's gravatar image

4★priyanjitdey94
213
accept rate: 0%

edited 24 Mar '15, 13:50

admin's gravatar image

0★admin ♦♦
19.8k350498541

what error are you getting ?

(23 Mar '15, 12:00) arun_as1★

Dont know.. I am checking my solution with some testcases and also the AC solutions.Both are giving same result.Still WA. :(

(23 Mar '15, 12:14) priyanjitdey944★

You are getting wrong answers for these test cases

5

AABAA

correct ans = AAAAB

6

ABCDE

correct ans = ABCDE

3

BAA

correct ans = AAB

5

ADBCD

correct ans = ABCDD

See here.

link

answered 23 Mar '15, 12:30

shivam217's gravatar image

4★shivam217
8383515
accept rate: 20%

edited 23 Mar '15, 12:36

Thanks a lot.I was not considering this testcases. :) @shivam217

(23 Mar '15, 22:20) priyanjitdey944★
1

your welcome :)

(23 Mar '15, 23:39) shivam2174★

For the case : 5 ADBCD correct ans should be ABDCD

link

answered 23 Mar '15, 23:50

aayushkhemka89's gravatar image

4★aayushkhemka89
1314
accept rate: 0%

bro, if we pick "D" and move it last position then we will get "ABCDD" and "ABCDD" is lexicographically smaller than "ABDCD" .

(24 Mar '15, 00:00) shivam2174★

oh yes....sorry my bad

(24 Mar '15, 00:26) aayushkhemka894★

for the test case DABC your code will give ans ADBC but the correct ans would be ABCD (by moving D to the end)

link

answered 24 Mar '15, 02:13

sharru05's gravatar image

3★sharru05
5591723
accept rate: 14%

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×643
×28
×9

question asked: 23 Mar '15, 11:57

question was seen: 1,421 times

last updated: 24 Mar '15, 13:50