Q1 Part 2:
-----------------------------------------
Still the same idea like Q1 Part 1. 
This time you don't depend on the length of the input.
Cache previous frequencies. 
Wrap the summation around a infinite while loop, check if the frequence exist after summation.


Q1 Part 1:
-----------------------------------------
The frequency is calculating by arithmetic operation. 
You can just sum them even if its negative.
The frequency will fluctuate between >+0, 0, and <-0
