To an array I want to update some elements and keep array\'s size no great than N. How to do it in an single operation? Lets\' make an example to make my question clear: