https://medium.com/@divakarneelakandan/leetcode-javascript-solution-merge-sorted-array-day-2-18b8629527e4