There was a flashback and everything. Anyhow, time to reveal my scheme to take over the tri-SE-network area. Behold, ginger the catapus, the doofenshmirtz-reference-inator! With one push of a button everyone in chat rooms on pldi, code golf and code review will have no choice but to join in with making doofenshmirtz references
Given an input string, first convert each character to its ASCII value.
Generate a reversed Fibonacci sequence of the same length as the input string.
Encode each character by adding its ASCII value to the corresponding number in the reversed Fibonacci sequence.
Convert the resulting values back...
@l4m2 I think in general it obfuscates what's actually going on, so I don't especially like it. (E.g. unlike with a typical infix operator, you can remove one pair of parentheses but not the other.)
CMC Is it a recursive palindrome? A recursive palindrome is a palindrome and each half, either including or excluding the middle character, is also a recursive palindrome
So ababa and abacaba are both recursive palindromes, as well as ababacababa
Good question, I theory it's 2^log(n) = n I guess but I'm not sure if it's possible to contrust a test case that actually requires recursing that far
I think it's log(N) because it's impossible for both x and x[:-1] to both be a palindrome unless it's just a single letter repeating, and if it's a single letter repeating both branches will return true thus the second branch will never be entered
That's true, but it makes the question a bit boring since you obviously need to check every character via the equals. Assuming it's O(1) would make the question more interesting. In practice the string comparision is going to be done in C which is a lot faster than python so it might be a decent enough approximation even if it's incorrect