Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 64
    wouldn't this create a copy of yourArray, pop the last element and then throw the temporary copy away? I think this would be a costly operation if yourArray has a large number of elements. Commented Aug 20, 2017 at 3:32
  • @chitti or they just go to the last index and give you a copy of that element Commented Jul 21, 2018 at 0:55