For any two non-empty strings A and B, we define the following sequence :
F(0) = A F(1) = B F(n) = F(n-1) + F(n-2)
+ denotates the standard string concatenation.
The sequence for strings "A" and "B" starts with the following terms: A, B, BA, BAB, BABBA, ...
Create a function or program that, when given two strings
B, and a positive integer
I returns the
I-th character of
You may choose to use 0-indexing or 1-indexing for
I, just specify it in your answer.
You may assume the strings contain only uppercase (or lowercase) letters.
This is a variation of Project Euler's Problem 230, where the two strings were strings of digits of equal length, which trivialize the problem.
You may choose any format for the input. The output should only contain the desired character, with trailing spaces/newlines allowed.
ABC, DEF, 1234567890 → A ACBB, DEFGH, 45865 → B A, B, 3 → B ABC, DEF, 10 → E
This is code-golf, so the lowest byte count for each language wins!