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/reduce_array_size_half.cpp | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/reduce_array_size_half.cpp')
-rw-r--r-- | other/reduce_array_size_half.cpp | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/other/reduce_array_size_half.cpp b/other/reduce_array_size_half.cpp deleted file mode 100644 index fd922dc..0000000 --- a/other/reduce_array_size_half.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int minSetSize(vector<int> &arr) { - int ans = 0, n = arr.size(), n1 = 0; - vector<int> j; - unordered_map<int, int> um; - for (int i = 0; i < n; i++) - um[arr[i]]++; - for (auto x : um) - j.push_back(x.second); - if (j.size() == 1) - return 1; - sort(j.begin(), j.end()); - for (int i = j.size() - 1; i >= 0; i--) { - if (ans >= n / 2) - return n1; - n1++; - ans = ans + j[i]; - } - return 0; - } -}; - -int main() { - Solution obj; - vector<int> arr = {3, 3, 3, 3, 5, 5, 5, 2, 2, 7}; - cout << obj.minSetSize(arr); -} |