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 Answer

deleted 13 characters in body
Source Link
recursive
  • 10.5k
  • 21
  • 36

Stax, 13 bytes

绬►Ö∞j∞:Æ╘τδ

Run test cases 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.

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.

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.
added 119 characters in body
Source Link
recursive
  • 10.5k
  • 21
  • 36

Stax Stax, 1413 bytes

σ≡⌠≡╛┬H?#◘o▄↓₧绬►Ö∞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=f{$cr=}gs|Ncr=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
 {$cr=}w Predicate: flatten, then test for palindromocityRun the rest of the program repeatedly while a truth value is produced.
 |N gs ApplyGet the followingnext transformpermutation.
 until predicate is satisfied c$ Copy and flatten the permutation.
 cr=! |N Test if Getit's thepalindrome. next lexicographicIf not, repeat.
 The last permutation produced will be implicitly printed.

Stax, 14 bytes

σ≡⌠≡╛┬H?#◘o▄↓₧

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

This is the corresponding ascii representation of the same program.

:e{cr=f{$cr=}gs|N

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
 {$cr=} Predicate: flatten, then test for palindromocity.
 gs Apply the following transform until predicate is satisfied.
 |N Get the next lexicographic permutation.

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.
Source Link
recursive
  • 10.5k
  • 21
  • 36

Stax, 14 bytes

σ≡⌠≡╛┬H?#◘o▄↓₧

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

This is the corresponding ascii representation of the same program.

:e{cr=f{$cr=}gs|N

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
 {$cr=} Predicate: flatten, then test for palindromocity.
 gs Apply the following transform until predicate is satisfied.
 |N Get the next lexicographic permutation.

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