Given a few strings, how many strings can be lexicographically least by modifying the alphabet?
Posted
by
Jackson W
on Stack Overflow
See other posts from Stack Overflow
or by Jackson W
Published on 2012-12-16T22:58:44Z
Indexed on
2012/12/16
23:03 UTC
Read the original article
Hit count: 216
algorithm
|alphabetical
Number of strings can be huge as in 30000. Given N strings, output which ones can be lexicographically least after modifying the english alphabet. e.g. acdbe......
for example if the strings were:
omm moo mom ommnom
"mom" is already lexicographically least with the original english alphabet. we can make the word "omm" least by switching "m" and "o" in the alphabet ("abcdefghijklonmpqrstuvwxyz"). the other ones you cant make lexicographically last, no matter what you do.
any fast way to do this? I have no ways to approach this except try every single possible alphabet
© Stack Overflow or respective owner