Using #ColdFusion, I prefer using listToArray(valueList(query.column)) to get an array of database values because listToArray ignores empty (NULL) items by default while ValueArray lacks the ability to ignore NULL values. #notABug#cfml
Since LeetCode likes to turn simple problems into complicated ones, here's a very simple and much quicker solution for exercise n. 382 without doing all this mess.
Quick note: nums is actually arr, returned from the previous function "ListToArray".
#LeetCodeChallenge#coding