From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/design_number_container.cpp | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 other/design_number_container.cpp (limited to 'other/design_number_container.cpp') diff --git a/other/design_number_container.cpp b/other/design_number_container.cpp deleted file mode 100644 index bc37a6a..0000000 --- a/other/design_number_container.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// 2349. Design a Number Container System -#include "leetcode.h" - -/* - * design a number container system that can do the following: insert or replace - * a number at the given index in the system or return the smallest index for - * the given number in the system. implement the 'NumberContainers' class. - */ - -class NumberContainers { -private: - unordered_map idxs; - unordered_map> nums; - -public: - void change(int index, int number) { - auto i = idxs.find(index); - if (i != end(idxs)) - nums[i->second].erase(index); - idxs[index] = number; - nums[number].insert(index); - } - int find(int number) { - auto i = nums.find(number); - return i == end(nums) || i->second.empty() ? -1 : *begin(i->second); - } -}; - -int main() { - NumberContainers *obj = new NumberContainers(); - printf("%d\n", obj->find(10)); // expect: -1 - obj->change(2, 10); - obj->change(1, 10); - obj->change(3, 10); - obj->change(5, 10); - printf("%d\n", obj->find(10)); // expect: 1 - obj->change(1, 20); - printf("%d\n", obj->find(10)); // expect: 2 -} -- cgit v1.2.3