https://medium.com/@_monitsharma/daily-leetcode-problems-problem-946-validate-stack-sequences-50957a134f59