Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • \$\begingroup\$ Are the exact numbers in the inputs important, or just that the word and alphabet match? For example, in the last case is it necessary that the input represents "995" as a character in the alphabet, or only that the alphabet has 95 characters and the word uses the correct ones? Or, to put it most directly, is it alright if the alphabet is a list of bytes instead of numbers? \$\endgroup\$ Commented Oct 5, 2022 at 17:36
  • 1
    \$\begingroup\$ @KamilDrakari A list of bytes is just fine. After all, bytes are just small numbers- so long as you don't use that fact to trivialize the problem there is nothing wrong with using them. The key thing is that given a 95 character alphabet your answer should theoretically do the right thing, even if practical constraints like limited ram and the heat death of the universe get in the way. \$\endgroup\$ Commented Oct 5, 2022 at 17:47
  • 1
    \$\begingroup\$ It seems that the alphabet is always ordered naturally (i.e. a smaller integer always comes before a larger one) - is that guaranteed? (And if so, why not just use a prefix of the natural numbers rather than a sparse set?) \$\endgroup\$ Commented Oct 5, 2022 at 17:56
  • \$\begingroup\$ @JonathanAllan taking in the alphabet as a sorted list or ordered set (like a b-tree set or something) is explicitly allowed. I went with the sparse set primarily because I thought it made a slightly more interesting question. \$\endgroup\$ Commented Oct 5, 2022 at 18:38
  • 2
    \$\begingroup\$ @Arnauld you don't have to support those cases. Undefined means any behavior is valid, feel free to do whatever's golfiest. \$\endgroup\$ Commented Oct 5, 2022 at 23:16