Raisa Energy interview question

It was problem solving questions from leet code