Problems

Pure Component Skip Count

MediumReact Components

A memoized component re-renders only when props change (shallow equality on a single value). Input: a JSON array of successive prop values. Print two lines: the number of renders and the number of skips.

Input: JSON array of primitive prop values. Output: renders, then skips.

Your program reads from stdin and prints to stdout.

Example 1

Input: [1,1,2,2,2,3]

Output: 3 3

Hints

ReactComponentsMemo
Pure Component Skip Count | CodeForge AI