Binary Search Approach || C++ || O(nlog(n))
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nBinary Search to search
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nBinary Search to search the element in array (nums)\n\n# Complexity\n- Time complexity: O(nlog(n))\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n<!-- - Space complexity: -->\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     ListNode *next;\n *     ListNode() : val(0), next(nullptr) {}\n *     ListNode(int x) : val(x), next(nullptr) {}\n *     ListNode(int x, ListNode *next) : val(x), next(next) {}\n * };\n */\nclass Solution {\npublic:\n    bool bs(vector<int> &nums, int k){\n        int l =0;\n        int h =nums.size()-1;\n        while(l<=h){\n            int m = h + (l-h)/2;\n            if(nums[m]==k){\n                return true;\n            }\n            else if(nums[m]<k){\n                l=m+1;\n            }\n            else{\n                h = m-1;\n            }\n        }\n        return false;\n    }\n    ListNode* modifiedList(vector<int>& nums, ListNode* head) {\n        sort(nums.begin(),nums.end());\n        ListNode* temp = head;\n        ListNode* curr = temp;\n        while(temp->next!= nullptr){\n            \n            if(bs(nums,temp->next->val)){\n                cout<<temp->val<<endl;\n                ListNode* x = temp->next;\n                temp->next = temp->next->next;\n                delete x;\n            }\n            else{\n                temp = temp -> next;\n            }\n        }\n        //Below code for the 1st element of linked-list, the above \n        // "while loop" skips the first element\n        if(bs(nums,curr->val)){\n            ListNode* y= curr;\n            curr = curr->next;\n            delete y;\n        }\n        return curr;\n    }\n};\n\n```\n\n# \uD83D\uDC47Please Up-Vote
['Linked List', 'Binary Search', 'C++']