Postgresql Split Array Leetcode Problems Javascript