A render is WASTED when a component re-renders with identical props (JSON-equal). Input: a JSON array of render events {"component": string, "props": object} in time order. Print the number of wasted renders.
Input: one JSON array. Output: wasted count.
Your program reads from stdin and prints to stdout.
Example 1
Input: [{"component":"List","props":{"n":1}},{"component":"List","props":{"n":1}},{"component":"List","props":{"n":2}}]
Output: 1
Hints
A render is WASTED when a component re-renders with identical props (JSON-equal). Input: a JSON array of render events {"component": string, "props": object} in time order. Print the number of wasted renders.
Input: one JSON array. Output: wasted count.
Your program reads from stdin and prints to stdout.
Example 1
Input: [{"component":"List","props":{"n":1}},{"component":"List","props":{"n":1}},{"component":"List","props":{"n":2}}]
Output: 1
Hints