Skip to content

Instantly share code, notes, and snippets.

@lichray lichray/
Created Mar 24, 2017

What would you like to do?
"Two star programming" with no star
#include <functional>
class Solution {
ListNode* removeElements(ListNode* head, int val) {
auto ls = std::ref(head);
while (ls != nullptr) {
if (ls.get()->val == val) {
auto p = ls.get();
ls.get() = p->next;
delete p;
ls = ls.get()->next;
return head;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.