PROBLEM LINK:Author: Avijit Agarwal DIFFICULTY:CAKEWALK PREREQUISITES:Strings, Sorting PROBLEM:Given a string $S$ find the frequency of each character in the string and check whether they can be rearranged into a sequence $F$ where $F_i = F_{i2} + F_{i1}$ holds for all $i \ge 3$. EXPLANATION:Finding the frequency of each character can be done in linear time. One possible way is below
Next we can say that because $F_i = F_{i1} + F_{i2}$ and $F_{i2}$ cannot be $0$, $F_i > F_{i1}$ for all $i \ge 3$. So it makes sense to sort the array $F$. Then we can check if $F$ satisfies the given condition for all $i \ge 3$. If it does, then the string is dynamic otherwise it is not, right? ......But hold on, there is a catch. Indeed $F_i > F_{i1}$ for all $i \ge 3$, but what about $F_2$? The relation between $F_2$ and $F_1$ is not specified. So it maybe that $F_4 \ne F_2 + F_3$ in the sorted order but $F_4 = F_1 + F_3$. In that case if we can simply swap $F_1$ and $F_2$ to get the required sequence and the string is dynamic.
AUTHOR'S AND TESTER'S SOLUTION:Author's solution can be found here asked 16 Apr, 00:35

I think there were weak test cases in this question. This solution gets AC by only checking the first 3 distinct elements and ignoring the rest. For example, 1 abccddddddddddd should give "Not" as output where in the above mentioned code it is giving "Dynamic". answered 16 Apr, 01:02
