I have to create an array and insert elements using another function foreach method. when run function its return memory allocated error.
function getleftcounts(i