From dc1f0c4c0096013799416664894c5194dc7e1f52 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 28 Feb 2025 23:13:39 +0800 Subject: chore(store): move everything to store. --- works/solutions/leetcode/cpp/397.cpp | 47 ------------------------------------ 1 file changed, 47 deletions(-) delete mode 100644 works/solutions/leetcode/cpp/397.cpp (limited to 'works/solutions/leetcode/cpp/397.cpp') diff --git a/works/solutions/leetcode/cpp/397.cpp b/works/solutions/leetcode/cpp/397.cpp deleted file mode 100644 index bbb61ff..0000000 --- a/works/solutions/leetcode/cpp/397.cpp +++ /dev/null @@ -1,47 +0,0 @@ -class Solution -{ -public: - int integerReplacement(int n) - { - if (n == 2147483647) - return 32; - - int count = 0; - - while (n != 1) - { - if (n == 2) - { - count += 1; - break; - } - if (n == 3) - { - count += 2; - break; - } - if (n % 2 == 0) - { - count += 1; - n /= 2; - continue; - } - if ((n - 1) % 4 == 0) - { - count += 3; - n = (n - 1) / 4; - continue; - } - if ((n + 1) % 4 == 0) - { - count += 3; - n = (n + 1) / 4; - continue; - } - count += 2; - n = (n - 1) / 2; - } - - return count; - } -}; -- cgit v1.2.3