Skip to content

Commit c7d99f4

Browse files
authored
Update make-array-strictly-increasing.cpp
1 parent 01c3aed commit c7d99f4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

C++/make-array-strictly-increasing.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class Solution {
55
public:
66
int makeArrayIncreasing(vector<int>& arr1, vector<int>& arr2) {
77
std::sort(arr2.begin(), arr2.end());
8+
arr2.erase(unique(arr2.begin(), arr2.end()), arr2.end());
89
unordered_map<int, int> dp = {{0, -1}}; // dp[min_cost] = end_with_val
910
for (const auto& val1 : arr1) {
1011
unordered_map<int, int> next_dp;

0 commit comments

Comments
 (0)