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


CodeJam Practice

Question link :

Somebody please explain me what they mean by in the problem statement

' The contestant wins the game if their last word is the last of an alphabetically sorted list of all of the possible last words that could have been produced. '

Explain it with the example of a testcase from the problem itself. Thanks in advance. :)

asked 15 Nov '16, 09:43

rdrsadhu's gravatar image

accept rate: 11%

Suppose, ABC is input, you have to write input letter by letter so, first you will write A and then you have to add B, you can add B either on left side of A(i.e., BA) or on right side of A(i.e., AB), then you have to add C which can be added as following either left of BA(i.e., CBA), right of BA(i.e., BAC), left of AB(i.e., CAB) or right of AB(i.e., ABC). Out of all these combinations(CBA, BAC, CAB, ABC), CBA is the last word in alphabetically sorted list of all the possible combinations.


answered 15 Nov '16, 11:01

srd091's gravatar image

accept rate: 42%


Thanks @srd091

(15 Nov '16, 23:06) rdrsadhu4★
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: 15 Nov '16, 09:43

question was seen: 1,614 times

last updated: 15 Nov '16, 23:06