diff options
author | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
commit | a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch) | |
tree | e2a2b3f49f9fb741be81415266ac93e74cff42ec /other/rotate_function.cpp | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/rotate_function.cpp')
-rw-r--r-- | other/rotate_function.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/other/rotate_function.cpp b/other/rotate_function.cpp deleted file mode 100644 index 1bfd7f5..0000000 --- a/other/rotate_function.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int maxRotateFunction(vector<int> &nums) { - long sum = 0, fn = 0; - int len = nums.size(); - for (int i = 0; i < len; i++) { - sum += nums[i]; - fn += (i * nums[i]); - } - long l = 1, r, newFn = fn; - while (l < len) { - r = l + len - 1; - long removed = (l - 1) * nums[l - 1]; - long added = r * nums[r % len]; - newFn -= newFn - removed + added - sum; - fn = max(fn, newFn); - l++; - } - return fn; - } -}; - -int main() { - Solution obj; - vector<int> nums = {4, 3, 2, 6}; - cout << obj.maxRotateFunction(nums); -} |