Leetcode Medium Level Array Methods In Php