id
int64
1
3.58k
problem_description
stringlengths
516
21.8k
instruction
int64
0
3
solution_c
dict
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n if(*max_element(nums.begin(), nums.end()) == *min_element(nums.begin(), nums.end())) return nums;\n vector<int>res;\n map<int, int>mpp;\n for(int i: nums){\n string tem...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n\tint gen_new_val(vector<int>& mapping, int cur){\n\t\tint ret = 0;\n\t\tint mul_factor = 1;\n\t\tif(cur/10 == 0) return mapping[cur];\n\t\twhile(cur){\n\t\t\tret += mapping[cur%10] * mul_factor;\n\t\t\tcur /= 10;\n\t\t\tmul_factor *= 10;\n\t\t}\n\t\treturn ret;\n\t}\n vector<...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n\tint gen_new_val(unordered_map<int, int>& input_mm, int cur){\n\t\tint ret = 0;\n\t\tint mul_factor = 1;\n\t\tif(cur/10 == 0) return input_mm[cur];\n\t\twhile(cur){\n\t\t\tret += input_mm[cur%10] * mul_factor;\n\t\t\tcur /= 10;\n\t\t\tmul_factor *= 10;\n\t\t}\n\t\treturn ret;\n\...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n stable_sort(nums.begin(), nums.end(), [mapping](const int& a, const int& b){\n string a_ = to_string(a);\n string b_ = to_string(b);\n for(char& c: a_){\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\nprivate:\n vector<int> mapped;\n vector<int> res;\n int n;\npublic:\n void Exchange(int i, int j, vector<int>& x)\n {\n int k = x[i];\n x[i] = x[j];\n x[j] = k;\n }\n void QuickSort(int left, int right)\n {\n int i,j,h;\n int m;\n...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n \n\n vector<int> arr;\n vector<int> ans;\n int n = nums.size();\n \n //Map each number using the provided digit mapping\n for (int i = 0; i < n; i++) {\n int temp = 0, index, m...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution\n{\npublic:\n long CalcMapping(int num,\n vector<int>& mapping)\n {\n string num_str = std::to_string( num);\n \n for( auto& ch : num_str)\n {\n ch = mapping[ch - '0'] + '0';\n }\n \n num_str.erase( 0, num_str.find_first_not_of( '0'));\n\n ret...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n\n int m=nums.size();\n vector<int>v1;\n multimap<int,int>temp;\n for(int i=0;i<m;i++){\n int n=nums[i];\n int value=0;\n int k=0;\n int...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int num(int n, map<int, int>& mp) {\n string transformed = \"\";\n if (n == 0) \n {\n return mp[0];\n }\n\n while (n > 0) \n {\n int rem = n % 10;\n transformed += to_string(mp[rem]);\n n /=...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "unordered_map<int,int>ind;\nbool comp(pair<int,int>&a,pair<int,int>&b)\n{\n if(a.second<b.second)\n {\n return true;\n }\n else if(a.second>b.second)\n {\n return false;\n }\n return ind[a.first]<ind[b.first];\n}\nclass Solution {\npublic:\n vector<int> sortJumbled(vec...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n static bool cmp(pair<int,pair<int,int>>&a,pair<int,pair<int,int>>&b){\n if(a.second.second==b.second.second){\n return a.first<b.first;\n }\n return a.second.second<b.second.second;\n }\n\n vector<int> sortJumbled(vector<int>& mapping, vector<in...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n static bool cmp(pair<int, int> &a, pair<int, int> &b) {\n if(a.first<b.first) {\n return true;\n }\n else if(a.first==b.first && a.second<b.second) {\n return true;\n }\n return false;\n }\n vector<int> sortJumble...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\nprivate:\n int count(int num){\n int ans = 0;\n while(num){\n ans++;\n num /= 10;\n }\n return ans;\n }\n int sol(vector<int> &mapping, int original){\n if(original == 0) return mapping[0];\n int replaced = 0;\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<string> num;\n for(auto u : nums) num.push_back(to_string(u));\n vector<pair<int,int>> ans;\n int n=num.size();\n for(int i=0;i<n;i++){\n string s=num[i];...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<string> arr;\n for(auto &x:nums){\n arr.push_back(to_string(x));\n }\n for(auto &x:arr){\n for(int i = 0;i<x.size();i++){\n x[i] = mapp...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n bool static lambda(vector<int>&a, vector<int>&b){\n if(a[0]!=b[0])return a[0]<b[0];\n return a[1]<b[1];\n }\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n unordered_map<char,char>mp;\n int n = nums.size();\n for...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int convert_num(int num, vector<int> mapping){\n if(num == 0) return mapping[0];\n int ans=0,i=0;\n while(num){\n int rem=num%10;\n ans=mapping[rem]*pow(10,i)+ans;\n num/=10;\n i++;\n }\n return an...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n \n vector<vector<int>>store;\n for(int i=0;i<nums.size();i++){\n\n int num=0;\n int n=nums[i];\n int power=0;\n if(n==0) store.push_back({mapp...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\n int mappedValue(const vector<int> &mapping, int num) {\n if(num == 0) {\n return mapping[0];\n }\n int ans = 0, x = 1;\n while(num) {\n ans += mapping[num % 10] * x;\n num /= 10;\n x *= 10;\n }\n ret...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n map<pair<int, int>, int> mp;\n vector<pair<int, int>> arr;\n int i = 0;\n for (auto x: nums) {\n string s = to_string(x);\n string res = \"\";\n f...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n sort(nums.begin(), nums.end(), [mapping](const int& lhs, const int& rhs) {\n if (lhs < 0 && rhs > 0) {\n return true;\n }\n if (rhs < 0 && lhs > 0) {\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<int> ans;\n vector<string> temp;\n vector<pair<int, pair<int, int>>> s;\n for(int i=0;i<nums.size();i++){\n string tmp = to_string(nums[i]);\n temp.pu...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n\n void mapp(int n,unordered_map<int,int> &m,vector<int>& mapping){\n int ans=0;\n int i=0;\n int num=n;\n while (n!=0){\n int r=n%10;\n ans+=mapping[r]*pow(10,i);\n i++;\n n=n/10;\n }\n if (n==0){\n m...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "unordered_map<int, int> bikki;\nbool lol(int a, int b)\n{\n return bikki[a] < bikki[b];\n}\nclass Solution {\npublic:\n void convert(int a, vector<int>map)\n {\n iostream::sync_with_stdio(false); cin.tie(NULL);\n if(a == 0)\n {\n bikki[a] = map[a];\n retu...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\n struct comp{\n vector<int>map;\n bool operator()(pair<int, int> ab, pair<int, int> bc){\n int ctr =1;\n int num1 =0;\n int a = ab.first;\n if(a ==0){\n num1 = map[0];\n }else{\n while(a >0){\...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums)\n {\n int zero_slot=-1;\n for(int i=0;i<10;i++) if(mapping[i]==0){zero_slot=i; break;}\n vector<pair<int,int>> v;\n v.reserve(nums.size());\n for(int i=0;i<nums.size();i++) ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n long long int mapnum(vector<int> mapping, long long int num){\n if(num == 0){\n return mapping[0];\n }\n long long int newnum = 0,i = 0;\n while(num>0){\n long long int temp =num%10; //last number ex 991 -> 1\n newn...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Item {\npublic:\n int origin;\n int converted;\n int idx;\n\n Item() {};\n Item(int a, int b, int c) {\n origin = a;\n converted = b;\n idx = c;\n }\n bool operator<(const Item a) const {\n if (this->converted == a.converted)\n return this->...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n string getMappedValue(int num, const vector<int>& mapping) {\n string strNum = to_string(num);\n for (char& c : strNum) {\n c = '0' + mapping[c - '0'];\n }\n return strNum;\n}\n\nvector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n // Creat...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n \n // int m=mapping.size();\n int n=nums.size();\n vector<int>V;\n vector<pair<int,int>>ans;\n map<int,int>m,m1;\n if(n==1)\n {\n return ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n unordered_map<int,vector<int>> mappedIndex;\n vector<int> mappedValues;\n for (int j = 0; j < nums.size(); j++) {\n int n = nums[j];\n int m = 0;\n if (n...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n map<int,vector<int>> mpp;\n for(int i=0;i<nums.size();i++){\n int x = nums[i];\n long val = 1;\n long newNum = 0;\n if(x==0){\n newNum...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "typedef pair<int, int> pii;\n\nclass Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n map<int, vector<int>> p;\n for(auto num : nums) {\n int m;\n if(!num)\n m = mapping[num];\n else m = mapped(num, m...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n multimap<int,string>m;\n for(auto i:nums)\n {\n string s=to_string(i);\n string st=s;\n for(auto &i:s)\n i=('0'+mapping[i-'0']);\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n unordered_map<int, vector<int>> mp;\n vector<int> vec;\n int n = nums.size();\n for (int i=0; i<n; i++){\n string num = to_string(nums[i]);\n for (int k=0; k...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<int>conv;\n vector<int>ans;\n\n int place;\n int rem;\n int n;\n\n for(int x : nums){\n place = 0;\n n = 0;\n if(x == 0){\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<int>conv;\n vector<int>ans;\n\n int place;\n int rem;\n int n;\n\n for(int x : nums){\n place = 0;\n n = 0;\n if(x == 0){\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n map<int,vector<int>> mapped;\n for(int num : nums){\n mapped[getMapping(mapping,num)].push_back(num);\n }\n\n vector<int> res;\n for(const auto&kv:mapped){\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n \n map<int, vector<int>> map;\n\n for(int num: nums) {\n map[translator(mapping, num)].push_back(num);\n }\n\n vector<int> result;\n\n for(auto itr = map....
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n map<int, vector<int>> umap;\n vector<int> v;\n\n for(auto i : nums) \n {\n int val = i, mappedVal = 0;\n int tens = 1;\n while(val) {\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int func(vector<int> &mapping,int n){\n if(n==0)return mapping[0];\n int num=0;\n int i=0;\n while(n){\n int rem=n%10;\n num+=pow(10,i)*mapping[rem];\n i++;\n n/=10;\n }\n return num;\n }...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n static bool comparator(const vector<int>&a,const vector<int>&b){\n if(a[1]!=b[1]) return a[1]<b[1];\n return a[2]<b[2];\n }\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<vector<int>>v;\n\n for(int j=0;j<nums.si...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n class comp{\n public:\n bool operator()(vector<int>&a,vector<int>&b){\n if(a[0]<b[0]) return true;\n else if(a[0]==b[0]) return a[2]<b[2];\n else return false;\n }\n };\n vector<int> sortJumbled(vector<int>& mapping,...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n \n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n unordered_map<int,vector<int>>mp;\n vector<int>res=nums;\n for(int ind=0;ind<res.size();ind++){\n int x=res[ind];\n string s2=\"\";\n string s=to_st...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n // unordered_map<int,int>mp;\n // static bool comp(int x,int y){\n // if(mp[x]==mp[y])return \n // }\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n unordered_map<int,vector<int>>mp;\n vector<int>res=nums;\n for(int ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n int n = nums.size();\n map<int,vector<int>> mp;\n for(int i=0; i<n; i++){\n string temp = to_string(nums[i]);\n string s;\n for(int j=0; j<temp.size(); j...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n map<int,vector<int>> mp;\n\n for (int j = 0; j < nums.size(); j++) {\n\n // int converted = con(to_string(nums[i]), mapping);\n string ans,num = to_string(nums[j]);\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n#define append push_back\n\n int conv(string &s, vector<int> &v){\n string str=\"\";\n int n, i;\n for(auto ch: s){\n i = ch-'0';\n n = v[i];\n str.append(to_string(n)[0]);\n }\n int ans=0, m, zeroes, j;\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n\n int solve(int n , vector<int>& mapping){\n int temp = 0;\n if(n == 0){\n return mapping[0];\n }\n\n string p = to_string(n);\n string ans;\n for(int i = 0 ; i < p.size() ; i++){\n ans += char(mapping[ p[i] - '0...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<string>s;\n for(int i=0;i<nums.size();i++){\n s.push_back(to_string(nums[i]));\n }\n vector<vector<int>>changed;\n for(int i=0;i<s.size();i++){\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n map<int,vector<int>> store;\n vector<int> ans;\n vector<int> t;\n for(int i=0;i<nums.size();i++){\n int temp = nums[i];\n int num = 0;\n if(nums...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<int>mappedValues;\n map<int,vector<int>>reverseMapped;\n for(auto i:nums){\n string temp=\"\";\n for(auto j : to_string(i)){\n temp+=mapping[j...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n \n vector<int>mapped,ans;\n int n=nums.size();\n for(int i=0;i<n;i++){\n int num=nums[i];\n string str_num=to_string(num);\n\n int el=0;\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int solve(int a, vector<int>mapping)\n {\n string b = to_string(a);\n a=0;\n for(int i=0; i<b.length(); i++)\n {\n a = a*10+mapping[b[i]-'0'];\n }\n \n return a;\n }\n vector<int> sortJumbled(vector<int>...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int solve(int a, vector<int>mapping)\n {\n string b = to_string(a);\n a=0;\n for(int i=0; i<b.length(); i++)\n {\n a = a*10+mapping[b[i]-'0'];\n }\n \n return a;\n }\n vector<int> sortJumbled(vector<int>...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int change(int x,vector<int> &v){\n string s=to_string(x);\n int ans=0;;\n for(char i:s) ans=ans*10+v[i-'0'];\n return ans;\n }\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums){\n vector<int> v;\n int n=nums.si...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n static bool comp(string a,string b){\n int n1=stoi(a);\n int n2=stoi(b);\n if(n1<n2)return true;\n // if(n1==n2)return true;\n return false;\n }\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<strin...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "vector<int> mp;\nbool comp(vector<long long> & a, vector<long long> & b){\n if(a[1]!=b[1])return a[1]<b[1];\n return a[0]<b[0];\n}\n\nclass Solution {\n\npublic:\n vector<long long> convert(int a,int pos){\n \n vector<long long> res;\n res.push_back(pos);\n long long te...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n\n static bool mycomp(string a, string b){\n int t1 = stoi(a);\n int t2 = stoi(b);\n return t1 < t2;\n }\n\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<string> v;\n vector<int> ans;\n for(int i = 0;...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n map<int,vector<int>> m;\n set<int> s;\n int sum,d,c;\n int i,n=nums.size();\n for(i=0;i<n;i++){\n sum=0;\n d=1;\n c=nums[i];\n i...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n\n int f(int i,vector<int>& m){\n if(i==0){\n return m[0];\n }\n int ans = 0;\n int j = 1;\n while(i>0){\n ans += j*m[i%10];\n i /= 10;\n j*=10;\n }\n return ans;\n } \n\n vec...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\nvector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n unordered_map<int, int> dict;\n for(int i = 0; i < mapping.size(); ++i){\n dict[i] = mapping[i];\n }\n unordered_map<int, vector<int>> nums_dict;\n std::multiset<int> ans;\n for(int i = ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "static auto _ = [](){\n ios::sync_with_stdio(false);\n cin.tie(nullptr);\n cout.tie(nullptr);\n return nullptr;\n}();\n\nclass Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n \n map<int,vector<int>>map2;\n for(int i=0;i...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int mappedNo(vector<int>& m, int x)\n {\n string s = to_string(x);\n int c = 0;\n for(int i=0;i<s.length();i++)\n {\n c+=pow(10,s.length()-1-i)*(m[s[i]-'0']);\n }\n return c;\n }\n vector<int> sortJumbled(vector<in...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n static bool cmp(string s,string t){\n int a=0,b=0;\n for(int i=0;i<s.size();i++) a=a*10+(s[i]-'0');\n for(int i=0;i<t.size();i++) b=b*10+(t[i]-'0');\n return a<b;\n }\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n map<int,vector<int>>m;\n for(auto x:nums){\n string s=to_string(x);\n string newS1=\"\";\n for(auto y:s){\n int index=y-'0';\n new...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int conVertor(vector<int> map, int num)\n {\n if (num/10 == 0)\n return map[num];\n int res = 0;\n int cur_mult = 1;\n while(num > 0)\n {\n int digit = num % 10;\n num /= 10;\n res += map...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n // '0' -> 49\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<pair<string, int>> mapped{};\n unordered_map<string, int> mapped_to_original{};\n for(int i{} ; i < nums.size() ; ++i) {\n string tmp = to_string(nums...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "bool cmp (const pair<string,int> &a, const pair<string,int> &b) {\n if (stoi(a.first) == stoi(b.first)) {\n // cout<<a<<\" \"<<b;\n // if (a == b) {\n // return false;\n // }\n return a.second < b.second ;\n }\n return stoi(a.first) < stoi(b.first);\n}\n\ncla...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "auto init = []() {\n ios::sync_with_stdio(0);\n cin.tie(0);\n cout.tie(0);\n return 'c';\n}();\nclass Solution {\npublic:\n\n int value(int nums, vector<int> mapping){\n string s=to_string(nums);\n int len=s.size();\n int ans=0;\n for(int i=0;i<len;i++){\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n map<int, vector<int>> mp;\n vector<int> ans;\n vector<int> nn;\n for(int i:nums){\n int temp = i;\n int res=0;\n if(temp==0){\n res...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n map<int, vector<int>> mp;\n vector<int> ans;\n vector<int> nn;\n for(int i:nums){\n int temp = i;\n int res=0;\n if(temp==0){\n res...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int convert(vector<int> mapping,int no){\n if(no==0) return mapping[0];\n int newNo=0;\n int x=0;\n while(no!=0){\n int rem=mapping[no%10];\n newNo+=(pow(10,x)*rem);\n x++;\n no/=10;\n }return newN...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n \n int mp(int a,vector<int>mapping){\n string st=to_string(a);\n int n=st.size();\n string ans=\"\";\n for(int i=0;i<n;i++){\n ans+=to_string(mapping[st[i]-'0']);\n }\n // cout<<ans<<\" \";\n return stoi(ans);\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n // long long int change_num(vector<int> mapping,int num)\n // {\n // long long int ans=0;\n // while(num>=0)\n // {\n // int k=num%10;\n // ans=ans+mapping[k];\n // ans=ans*10;\n // num=num/10;\n // ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n unordered_map<int, int> um;\n\n inline int getTranslation(const int &a, const vector<int>& mapping) {\n if (um.count(a))\n return um.at(a);\n\n int i = a;\n int decimal_place = 1, num = 0;\n while (1) {\n const int digit = ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int conv(int val, vector<int> &mapping){\n int rvalue = mapping[val % 10];\n\n if (val / 10){\n rvalue += conv(val / 10, mapping) * 10;\n }\n\n return rvalue;\n }\n\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums)...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int MappingNumber(vector<int>& mapping, int num){\n string in_str = to_string(num);\n string out_str;\n for(int i = 0; i < in_str.length(); i++){\n string tmp = to_string(mapping[in_str[i] - '0']);\n out_str.append(tmp);\n }\n...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int transform(vector<int>& mapping, int num) {\n if (num == 0) return mapping[0];\n int temp = num, place = 1, result = 0;\n while (temp != 0) {\n result += place * mapping[temp % 10];\n place *= 10;\n temp /= 10;\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\nprivate:\n \n unordered_map<int,int>pos;\n int mapp(int a, vector<int>mapping)\n {\n if(a<10)\n return mapping[a];\n int temp = a;\n //int ans = 0;\n //cout<<temp<<endl;\n string ans;\n while(temp>0)\n {\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums){\n vector<string> arr;\n int n = nums.size();\n for(auto item : nums){\n arr.push_back(to_string(item));\n }\n unordered_map<int,int> mp;\n for(int i=0;i<10;i...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "int p(int &p ,vector<int> &m){int k=0,c=1,a=p;\ndo{\nk+=m[a%10]*c;a/=10;c*=10;\n\n}while(a);return k;\n\n}\nclass Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mp, vector<int>& a) {\n vector<int> m(10,0);\n map<int,vector<int>> frq;\n set<int> s;\n for(int i:mp){\n...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n vector<pair<int,pair<int,int>>> vp;\n for(int i=0;i<nums.size();i++) {\n int num = nums[i];\n if(num==0) {\n vp.push_back({mapping[0]+1, {i+1, num}});\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\n struct cmp\n {\n bool operator()(string s1, string s2)\n {\n if (s1.size() < s2.size())\n return true;\n if (s1.size() > s2.size())\n return false;\n return s1<s2;\n }\n };\npublic:\n vector<i...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int convert(vector<int> mp,int num)\n {\n int ans=0;\n int x=1;\n if(num==0)\n return mp[0];\n while(num)\n {\n int r=num%10;\n r=mp[r]*x;\n x*=10;\n ans=ans+r;\n num/=10;\n }\n return ans;\n\n }\n vector<...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int func(int n,vector<int>mapp)\n {\n int ans=0;\n if(n==0)\n return mapp[0];\n for(int i=1;n;i*=10)\n {\n ans+=mapp[n%10]*i;\n n/=10;\n }\n return ans;\n }\n vector<int> sortJumbled(vector<in...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int convertNum(int n , vector<int>mapping){\n vector<int> v; \n if(n == 0 )return mapping[0] ; \n int ans = 0 ; \n int factor = 1 ; \n while(n){\n int r = n % 10 ; \n ans += mapping[r]*f...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n void merge(vector<int>& arr, int l, int m, int r , unordered_map<int , int> &mp) {\n int n1 = m - l + 1;\n int n2 = r - m;\n\n vector<int> L(n1);\n vector<int> R(n2);\n\n // Copy data to temporary arrays L[] and R[]\n for (int i = 0; i < n1; i++)\n L[...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n unordered_map<int, int> mnums;\n for(auto&x:nums){\n int tmp = x;\n vector<char> mnum;\n do {\n mnum.push_back('0'+mapping[tmp%10]);\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n unordered_map<int, vector<short>> pre_order;\n for (short i = 0; i < nums.size(); i ++) {\n int num { nums[i] }, tmp {};\n char cnt {};\n do {\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "\nclass Solution {\npublic:\n unordered_map<int,int>mp;\n void merge(vector<int>&a,vector<int>&b,vector<int>&res){\n int i=0;\n int j=0;\n int k=0;\n while(i<a.size() and j<b.size()){\n if(mp[a[i]]<=mp[b[j]]){\n res[k]=a[i];\n k++;\...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n unordered_map<long, vector<int>> hash;\n for (auto num : nums) {\n int temp = num;\n int jumbled = 0;\n int place = 1;\n\n while (temp || !num) {\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\nprivate:\n int valueof(int num, vector<int>mapping){\n int val = 0,b=1;\n if(num == 0)\n return mapping[0];\n while(num>0){\n int rem = num%10;\n val = mapping[rem]*b+val;\n b *=10;\n num /=10;\n }\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n\n int mapNumber(int num, vector<int> &mapping) {\n vector<int> digits;\n while (num) {\n digits.push_back(num % 10);\n num /= 10;\n }\n if (digits.empty()) num = mapping[0];\n while (digits.size()) {\n num = ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n static bool compare(pair<int,vector<int>>&a, pair<int,vector<int>>&b){\n return a.first < b.first;\n }\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& a) {\n int i,j;\n unordered_map<int,vector<int>>mp;\n for(i=0;i<a.size();i++) ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n void merge(vector<pair<int, int>>& arr, int left, int mid, int right) {\n int n1 = mid - left + 1;\n int n2 = right - mid;\n \n vector<pair<int, int>> L(n1);\n vector<pair<int, int>> R(n2);\n \n for (int i = 0; i < n1; ++i)\n L[i] = arr[left + i];\...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int mappedValue( int n , vector<int>mapping){\n if(n==0)return mapping[0];\n int digit = 1 ;\n int ans = 0 ;\n while( n ){\n int rem = n % 10;\n ans = mapping[rem] * digit + ans ;\n digit *= 10;\n n /= 1...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n void merge(vector<int>& decidingarr,int s,int mid, int e, vector<int>& tobsorted)\n {\n int len=e-s+1;\n int i=0,a,b;\n int *da=new int[len];\n int *tbs=new int[len];\n a=s;\n b=mid+1;\n while(a<=mid&&b<=e)\n {\n ...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n unordered_map<int, vector<int>> newNums;\n for (int num: nums) {\n // Convert number to mapped value\n int mappedNum = convertNumber(mapping, num);\n // cout <<...
1,333
<p>You are given a <strong>0-indexed</strong> integer array <code>mapping</code> which represents the mapping rule of a shuffled decimal system. <code>mapping[i] = j</code> means digit <code>i</code> should be mapped to digit <code>j</code> in this system.</p> <p>The <strong>mapped value</strong> of an integer is the ...
3
{ "code": "class Solution {\npublic:\n int unjumble(vector<int>& mapping, int x) {\n vector<int> result_digits;\n do {\n result_digits.push_back(mapping[x % 10]);\n x /= 10;\n } while (x);\n reverse(result_digits.begin(), result_digits.end());\n return accum...