forked from Rohit91singh9/Coding-DP-DSA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfindDataLocations.cpp
More file actions
30 lines (25 loc) · 829 Bytes
/
Copy pathfindDataLocations.cpp
File metadata and controls
30 lines (25 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Solution {
public:
vector<int> findDataLocations(vector<int> locations, vector<int> movedFrom, vector<int> movedTo) {
set <int> ans;
for(int x:locations) ans.insert(x);
for(int i=0;i<movedFrom.size();i++){
if(movedFrom[i]!=movedTo[i]){
ans.erase((movedFrom[i]));
ans.insert(movedTo[i]);
}
}
vector<int> a;
for(int i:ans){
a.push_back(i);
}
return a;
}
/* NOTE:
I completed this Assessment during Amazon Hackerrank 1st Round
If you can figure out any other Approach to solve this problem,
feel free to share me the Code which will help other candidate.
I would love to hear from you on the Mail ID I have Provided.
if you've cracked the Interview.
beingactual@gmail.com
*/