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

Return to Revisions

3 of 3
deleted 13 characters in body
recursive
  • 10.5k
  • 21
  • 36

Stax, 13 bytes

绬►Ö∞j∞:Æ╘τδ

Run test cases (It takes about 10 seconds on my current machine)

This is the corresponding ascii representation of the same program.

:e{cr=fw|Nc$cr=!

It's not quite pure brute-force, but it's just as small as the brute-force implementation I wrote. That one crashed my browser after about 10 minutes. Anyway, here's how it works.

:e Get all contiguous substrings
 {cr=f Keep only those that are palindromes
 w Run the rest of the program repeatedly while a truth value is produced.
 |N Get the next permutation.
 c$ Copy and flatten the permutation.
 cr=! Test if it's palindrome. If not, repeat.
 The last permutation produced will be implicitly printed.
recursive
  • 10.5k
  • 21
  • 36

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