Completed Array algorithm problems