The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.

Show your WorkFrom the old forum

Success Puzzle

No replies yet

  1. I occasionally like to use Nodebox to solve puzzles on Quora. Today's solution was particularly satisfying:

    Question: In how many ways can the letters of the word "success" be arranged such that no two "s" come next together?

    The answer is 120. I was able to solve this in Nodebox using only six nodes:

    (Refer to attached screenshot)

    The make_strings node turns “success” into seven letters.

    The orderings node, from my Cartan Node Library, produces all 5040 ways of reordering those seven letters.

    The distinct node eliminates duplicates, leaving 420 distinct arrangements.

    The contains node yields “true” for each arrangement that contains “ss”.

    The equals node yields false for “ss” arrangements and true for all others

    The cull nodes removes all arrangements containing “ss”, leaving the 120 possible arrangements.

    NOTE: This assumes the two c’s in success are interchangeable. If you wanted to treat them as separate letters (e.g. if you colored the letters so the first c was blue and the second c was red), there would 240 possible arrangements. I double-checked this by simply changing the second c to an x in the first node.

    Link to Quora answer: https://www.quora.com/In-how-many-ways-can-the-letters-of-the-word-success-be-arranged-such-that-no-two-s-come-next-together/answer/John-Cartan

    Copy link

Know something that helps?

Sign in with your email address to reply. No password needed.

Sign in to reply