Postgres Split Array Into Equal Sum Coding Ninjas Problem