added solution for array6