classSolution{public:intget(int n){int result =0;while(n){
result +=(n%10)*(n%10);
n /=10;}return result;}boolisHappy(int n){
set<int>s;
n =get(n);while(n){if(n ==1)returntrue;if(s.count(n))returnfalse;
s.insert(n);
n =get(n);}returnfalse;}};
classSolution{public:
vector<int>twoSum(vector<int>& nums,int target){
unordered_map<int,int>m;for(int i =0; i < nums.size(); i++){if(m.count(target-nums[i]))return{ i, m[target-nums[i]]};else
m[nums[i]]= i;}return{};}};