Advertisement
Guest User

function

a guest
Nov 13th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. list<int>& function1(list<int>& l)
  2. {
  3.     int n = l.size();
  4.     int i = 0;
  5.     list<int>::iterator it = l.begin();
  6.     while (it != l.end())
  7.     {
  8.         if (*it == n - i - 1)
  9.         {
  10.             it = l.erase(it);
  11.         }
  12.         else
  13.         {
  14.             ++it;
  15.         }
  16.         ++i;
  17.     }
  18.     return l;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement