Trading Central interview question

One leet code easy array question