Implement "Roots of a function" problem.