๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
def cardinalitySort(nums): return sorted(nums, key=lambda num: [bin(num).count('1'), num]) Cardinality sorting JP Morgan โ
#include <bits/stdc++.h>
using namespace std;
bool checkbit(int n,int i){
return n&(1<<i);
}
bool cmp(const pair<int,int> &a,const pair<int,int>&b){
return a.second<b.second;
}
int main() {
// your code goes here
int n;cin>>n;
int a[n];
for(int i=0;i<n;i++) cin>>a[i];
vector<pair<int,int>> v;
for(int i=0;i<n;i++){
int c=0;
for(int j=0;j<31;j++){
if(checkbit(a[i],j)) c++;
}
v.push_back({a[i],c});
}
int idx = 0;
sort(v.begin(),v.end(),cmp);
for(auto it : v){
a[idx++] = it.first;
cout<<it.second<<" ";
}
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
return 0;
}
C++โ
using namespace std;
bool checkbit(int n,int i){
return n&(1<<i);
}
bool cmp(const pair<int,int> &a,const pair<int,int>&b){
return a.second<b.second;
}
int main() {
// your code goes here
int n;cin>>n;
int a[n];
for(int i=0;i<n;i++) cin>>a[i];
vector<pair<int,int>> v;
for(int i=0;i<n;i++){
int c=0;
for(int j=0;j<31;j++){
if(checkbit(a[i],j)) c++;
}
v.push_back({a[i],c});
}
int idx = 0;
sort(v.begin(),v.end(),cmp);
for(auto it : v){
a[idx++] = it.first;
cout<<it.second<<" ";
}
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
return 0;
}
C++โ
Pair Xor
C++โ
C++โ
XOR and Inversion
C++โ
C++โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
KPMG is hiring #freshers for the post of Full Stack Developer Analyst!
Experience - 0 to 3 Year's
Location - Pune
Salary Range - 5.5 to 13 LPA
Apply Now -
https://lnkd.in/dutPG9TV
Experience - 0 to 3 Year's
Location - Pune
Salary Range - 5.5 to 13 LPA
Apply Now -
https://lnkd.in/dutPG9TV
lnkd.in
LinkedIn
This link will take you to a page thatโs not on LinkedIn
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Tata 1mg
Role: SDE 1 - Frontend
Batch eligible: 2021, 2022 and 2023 grads
Apply: https://1mg.darwinbox.in/ms/candidate/careers/a64f836a03fe49
Role: SDE 1 - Frontend
Batch eligible: 2021, 2022 and 2023 grads
Apply: https://1mg.darwinbox.in/ms/candidate/careers/a64f836a03fe49
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Amazon is hiring for Data Scientist Interns!
Batch : 2023 / 2024 / 2025
Locations : Bangalore, Hyderabad, Chennai
Expected Salary: INR 20k - 25k/month (via Glassdoor)
Apply - https://lnkd.in/d57QbTUS
Batch : 2023 / 2024 / 2025
Locations : Bangalore, Hyderabad, Chennai
Expected Salary: INR 20k - 25k/month (via Glassdoor)
Apply - https://lnkd.in/d57QbTUS
Anyone give zscaler OA exam 11am
๐4
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Enalo
Role: Fullstack developer intern
Batch eligible: 2023 and 2024 grads
Apply: https://bit.ly/3R9hVFM
Role: Fullstack developer intern
Batch eligible: 2023 and 2024 grads
Apply: https://bit.ly/3R9hVFM
cuvette.tech
Fullstack Developer Internship in Enalo at Hyderabad, Telangana, India | Cuvette
Apply For Fullstack Developer Internship | Skills required are React.js, Redux, Typescript | Stipend โน20K-20K | Job Offer โน 7 LPA - 11 LPA | FULL-TIME INTERNSHIP | Location is Work from Home
๐1
def buildTree(inorder, preorder):
if not inorder or not preorder:
return []
rval = preorder.pop(0)
idx = inorder.index(rval)
lin = inorder[:idx]
rin = inorder[idx + 1:]
l_pr = [val for val in preorder if val in lin]
r_pr = [val for val in preorder if val in rin]
root = [rval, buildTree(lin, l_pr), buildTree(rin, r_pr)]
return root
def postorderTraversal(root):
if not root:
return []
result = []
result += postorderTraversal(root[1])
result += postorderTraversal(root[2])
result.append(root[0])
return result
def Fin_PostOrder(cls ,input1, input2, input3):
if input1 == 0:
return []
root = buildTree(input2, input3)
postorder = postorderTraversal(root)
return postorder
Tata mgโ
Python 3
Find the postorder transversal
if not inorder or not preorder:
return []
rval = preorder.pop(0)
idx = inorder.index(rval)
lin = inorder[:idx]
rin = inorder[idx + 1:]
l_pr = [val for val in preorder if val in lin]
r_pr = [val for val in preorder if val in rin]
root = [rval, buildTree(lin, l_pr), buildTree(rin, r_pr)]
return root
def postorderTraversal(root):
if not root:
return []
result = []
result += postorderTraversal(root[1])
result += postorderTraversal(root[2])
result.append(root[0])
return result
def Fin_PostOrder(cls ,input1, input2, input3):
if input1 == 0:
return []
root = buildTree(input2, input3)
postorder = postorderTraversal(root)
return postorder
Tata mgโ
Python 3
Find the postorder transversal
function findSubsequence(arr)
{
var a = [-1];
var list = [];
const letters = new Set();
let maxInteger = 0;
for (let i = 0; i < = arr.length - 1; i++)
{
if (letters.has(arr[i]))
{
if (maxInteger <= arr[i])
{
maxInteger = arr[i];
list.push(arr[i]);
}
else
{
return a;
}
}
else
{
letters.add(arr[i]);
}
}
return list;
}
Subsequence Removalโ
Zscaler
{
var a = [-1];
var list = [];
const letters = new Set();
let maxInteger = 0;
for (let i = 0; i < = arr.length - 1; i++)
{
if (letters.has(arr[i]))
{
if (maxInteger <= arr[i])
{
maxInteger = arr[i];
list.push(arr[i]);
}
else
{
return a;
}
}
else
{
letters.add(arr[i]);
}
}
return list;
}
Subsequence Removalโ
Zscaler
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Kirana Club is hiring Product Analyst
For 2023/2022/2021 Grads
Apply: https://docs.google.com/forms/d/e/1FAIpQLSfDHhEgphm6bqQI7U6dYUSYQXgGhn_Uiu0K0408ZjQbNftAUA/viewform
For 2023/2022/2021 Grads
Apply: https://docs.google.com/forms/d/e/1FAIpQLSfDHhEgphm6bqQI7U6dYUSYQXgGhn_Uiu0K0408ZjQbNftAUA/viewform
int bits(int a)
{
int z=0;
while(a)
{
z=z+(a%2);
a=a/2;
}
return z;
}
long count(vector<int>a,int k)
{
int i=0;
long z=0;
vector<int>u;
for(int i=0;i<a.size();i++)
{
u.push_back(bits(a[i]));
}
int j=u.size()-1;
while(j>i)
{
if(k>u[i]+u[j])
{
i++;
}
else
{
z=z+((long long)j-i);
j--;
}
}
return z;
}
Bits in Archie โ
Zscaler
{
int z=0;
while(a)
{
z=z+(a%2);
a=a/2;
}
return z;
}
long count(vector<int>a,int k)
{
int i=0;
long z=0;
vector<int>u;
for(int i=0;i<a.size();i++)
{
u.push_back(bits(a[i]));
}
int j=u.size()-1;
while(j>i)
{
if(k>u[i]+u[j])
{
i++;
}
else
{
z=z+((long long)j-i);
j--;
}
}
return z;
}
Bits in Archie โ
Zscaler
๐1
vector<int> par, sz;
int find(int u){
if(u==par[u])
return u;
return par[u] = find(par[u]);
}
void dsu(int a, int b){
a = find(a);
b = find(b);
if(a!=b){
if(sz[a]<sz[b])
swap(a, b);
sz[a] += sz[b];
par[b] = a;
}
}
vector<int> getVisibleProfilesCount(int connection_nodes, vector<int> conncection_from, vector<int> connection_to, vector<int> queries){
par = vector<int>(connection_nodes+1);
sz = vector<int>(connection_nodes+1, 1);
for(int i=1;i<=connection_nodes;i++){
par[i]=i;
}
for(int i=0;i<conncection_from.size();i++){
find(i);
}
vector<int> ans(queries.size());
for(int i=0;i<queries.size();i++){
ans[i]=sz[par[queries[i]]];
}
return ans;
}
Social Connection โ
Zscaler
int find(int u){
if(u==par[u])
return u;
return par[u] = find(par[u]);
}
void dsu(int a, int b){
a = find(a);
b = find(b);
if(a!=b){
if(sz[a]<sz[b])
swap(a, b);
sz[a] += sz[b];
par[b] = a;
}
}
vector<int> getVisibleProfilesCount(int connection_nodes, vector<int> conncection_from, vector<int> connection_to, vector<int> queries){
par = vector<int>(connection_nodes+1);
sz = vector<int>(connection_nodes+1, 1);
for(int i=1;i<=connection_nodes;i++){
par[i]=i;
}
for(int i=0;i<conncection_from.size();i++){
find(i);
}
vector<int> ans(queries.size());
for(int i=0;i<queries.size();i++){
ans[i]=sz[par[queries[i]]];
}
return ans;
}
Social Connection โ
Zscaler
Anyone give Linkedin OA exam
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Wenger & Watson is hiring MBA freshers
Education : MBA(HR)
Role : Management Trainee
Passing year : 2021, 2022 and 2023 batch
Location : Bangalore
โข Excellent Communication
โข Immediate joiner
Interested candidates can send their resumes to hannan.sameed@wengerwatson.com
Education : MBA(HR)
Role : Management Trainee
Passing year : 2021, 2022 and 2023 batch
Location : Bangalore
โข Excellent Communication
โข Immediate joiner
Interested candidates can send their resumes to hannan.sameed@wengerwatson.com