JavaScript Simulator (Auto Input)

You can use the input array directly. No need to write require('fs')!

1. JavaScript Code

2. Input Data

3. Output

Result will be displayed here.