C++ Version, Using lower_bound O(lgN)???
Not an elegant one.\nBut we can ignore some point during the poisoning time.\nCan someone confirm whether this is an O(lgN) algorithm or not?\n\n\nint findPoiso
Not an elegant one.\nBut we can ignore some point during the poisoning time.\nCan someone confirm whether this is an O(lgN) algorithm or not?\n\n```\nint findPoisonedDuration(vector<int>& timeSeries, int duration) {\n        int res = 0;\n        for(auto it = timeSeries.begin(); it != timeSeries.end(); ) {\n            auto e = lower_bound(it + 1, timeSeries.end(), *it + duration);\n            if(e == timeSeries.end()) {\n                res += duration + *(e - 1) - *it;\n                break;\n            }\n            else if(*e == *it + duration) {\n                it = e;\n                res += duration;\n            }\n            else {\n                if((e - 1) == it) {\n                    it = e;\n                    res += duration;\n                }\n                else {\n                    res += *(e - 1) - *it;\n                    it = e - 1;\n                }\n            }\n        }\n        return res;\n    }\n```
[]