Implement useMemo(factory, deps) that:
factory() and caches the result.factory() only when any dep (compared with Object.is) changes.solve(steps) runs an expensive computation that records call counts.
Each step has { deps }. Returns total number of factory invocations.
Sample tests