You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/WvLuA-LCsb0
vector<int> icecreamParlor(int m, vector<int> arr) { map<int, int> mp; for (int i = 0; i < arr.size(); i++) { int complement = m - arr[i]; if (mp.count(complement)) { return {mp[complement] + 1, i + 1}; } mp[arr[i]] = i; } return {}; }
Seems like cookies are disabled on this browser, please enable them to open this website
Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/WvLuA-LCsb0