Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

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*

Required fields*

Can we spell a third number?

You are given two strings, each consisting of the English word for a number between 1 and 13:

one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen

Your program or function must find out whether it's possible to spell at least one other word from the same list without using any of the letters used in the two input words.

You can follow this link to see a naive, ungolfed implementation along with the table of all possible I/O.

Examples

  • If the input is ['six', 'four'], we can spell 'ten', 'eleven' or 'twelve' so the answer is yes.

  • If the input is ['five', 'seven'], we can only spell 'two' but the answer is still yes.

  • If the input is ['one', 'six'], we cannot spell any other number so the expected answer is no.

Rules

  • You may take the words in any reasonable format. They can be in either lower case ('one'), upper case ('ONE') or title case ('One'), but it must be consistent.
  • You may be given twice the same word.
  • The order of the words is not guaranteed (i.e. your code must support both ['four', 'six'] and ['six', 'four']).
  • You may return either truthy / falsy values (inverting the meaning is permitted) or two distinct and consistent values of your choice.
  • This is .

Answer*

Draft saved
Draft discarded
Cancel
3
  • \$\begingroup\$ You can use Λ here: Try it online! \$\endgroup\$ Commented Dec 7, 2020 at 8:32
  • \$\begingroup\$ -2 bytes with n: Try it online! \$\endgroup\$ Commented Dec 7, 2020 at 8:33
  • \$\begingroup\$ @Razetime - Thanks & thanks! Really nice! I was hoping that it would be possible for Husk to be the shortest answer (at least so far), but just needed those extra tips! \$\endgroup\$ Commented Dec 7, 2020 at 9:10

AltStyle によって変換されたページ (->オリジナル) /