useMemo recomputes only when deps change. Input: one line per render with the dep value (a single number). Print two lines: total computations, total cache hits.
Input: one dep per line. Output: computations, then hits.
Your program reads from stdin and prints to stdout.
Example 1
Input: 1 1 2 2 2
Output: 2 3
Hints
useMemo recomputes only when deps change. Input: one line per render with the dep value (a single number). Print two lines: total computations, total cache hits.
Input: one dep per line. Output: computations, then hits.
Your program reads from stdin and prints to stdout.
Example 1
Input: 1 1 2 2 2
Output: 2 3
Hints