Can you give me a hint for G4?
It's a little difficult to give hints for this level as there seem to be more strategies to solving it than are known to me. It's easier with root, even if that won't necessarily lead to a non-root solution.
I'm doing a non-root solution which is VERY inefficient, more than 1000000 cycles on some inputs. I will improve tho.