LeetCode solutions

2274. Keep Multiplying Found Values by Two

My accepted C++ solution to LeetCode problem 2274, Keep Multiplying Found Values by Two, running in 0ms.

  • Difficulty: Easy
  • C++
  • Runtime 0ms
  • Memory 15.9MB

Read the problem on LeetCode View on GitHub

C++

Accepted on LeetCode — runtime 0ms, memory 15.9MB, accepted 2025-12-27.

cpp
class Solution {
    public:
    int findFinalValue(vector<int>& nums, int original) {
        unordered_set<int> s(nums.begin(), nums.end());
        while (s.count(original)) original *= 2;
        return original;
    }
};

Source