aboutsummaryrefslogtreecommitdiff
path: root/other/tallest_billboard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'other/tallest_billboard.cpp')
-rw-r--r--other/tallest_billboard.cpp26
1 files changed, 0 insertions, 26 deletions
diff --git a/other/tallest_billboard.cpp b/other/tallest_billboard.cpp
deleted file mode 100644
index 1201823..0000000
--- a/other/tallest_billboard.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "leetcode.h"
-
-class Solution {
-public:
- int tallestBillboard(vector<int> &rods) {
- unordered_map<int, int> dp;
- dp[0] = 0;
- for (int i : rods) {
- unordered_map<int, int> tmp;
- for (auto &it : dp) {
- int diff = it.first;
- tmp[diff + i] = max(tmp[diff + i], dp[diff] + i);
- tmp[diff - i] = max(tmp[diff - i], dp[diff]);
- }
- dp.clear();
- dp.insert(tmp.begin(), tmp.end());
- }
- return dp[0];
- }
-};
-
-int main() {
- Solution obj;
- vector<int> rods = {1, 2, 3, 6};
- cout << obj.tallestBillboard(rods);
-}