Php Get And Remove Element Leetcode C