/
fluffymax2005
/
leetcode-solutions
Обзор
Документация
Войти
/
fluffymax2005
/
leetcode-solutions
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
remove-element/main.cpp
18 строк
337 B
fluffymax2005
"Remove element" implemented
11 мар 2026, 10:01
11 мар 2026, 10:01
3ff0930
Код
Авторство
О чём код?
// https://leetcode.com/problems/remove-element/ #include <vector> class Solution { public: int removeElement(std::vector<int> &nums, int val) { unsigned char i = 0; for (unsigned char j = 0; j < nums.size(); ++j) { if (nums[j] == val) { continue; } nums[i++] = nums[j]; } return i; } };