Forwarded from allcoding1
import requests
import json
def getCaptialCity(country):
api_request = requests.get(''//@allcoding1 name='+country)
data = api_request.json()['data']
if(len(data[0]['capital'])==0)
return -1
return data[0]['capital']
country = input()
print(getCapitalCity(country))
Python
IBM exam Ans
Telegram:- @allcoding1
import json
def getCaptialCity(country):
api_request = requests.get(''//@allcoding1 name='+country)
data = api_request.json()['data']
if(len(data[0]['capital'])==0)
return -1
return data[0]['capital']
country = input()
print(getCapitalCity(country))
Python
IBM exam Ans
Telegram:- @allcoding1
π14π3
This media is not supported in your browser
VIEW IN TELEGRAM
β€19π14π₯10π3π1
π―HCL Off Campus Hiring for Freshers as Engineer Trainee | 3-5LPA
Job Role:- Engineer Trainee
Education:- Any Degree
Batch:- Any Batch
CTC/Salary:- 3-5 LPA
Apply Now:- www.allcoding1.com
Telegram:- @allcoding1
Videoπ
π ΎοΈInstagram:- https://instagram.com/allcoding1_official?utm_source=qr&igshid=NGExMmI2YTkyZg%3D%3D
βYouTube :- https://youtube.com/shorts/TMaL15W0p3g?feature=share
Job Role:- Engineer Trainee
Education:- Any Degree
Batch:- Any Batch
CTC/Salary:- 3-5 LPA
Apply Now:- www.allcoding1.com
Telegram:- @allcoding1
Videoπ
π ΎοΈInstagram:- https://instagram.com/allcoding1_official?utm_source=qr&igshid=NGExMmI2YTkyZg%3D%3D
βYouTube :- https://youtube.com/shorts/TMaL15W0p3g?feature=share
π9β€2π1
π―GlobalLogic off Campus Drive 2023 | Associate Analyst | Gurgaon | Rs 3.5-4.5 LPA
Job Role:- Associate Analyst
Qualification:- Any Graduate
Batch:- Any Batch
Salary/CTC:- Rs 3.5-4.5 LPA
Apply Now;- http://www.allcoding1.com
Video:- https://youtube.com/shorts/tWPfvbhtPgI?feature=share
Telegram:- @allcoding1
Job Role:- Associate Analyst
Qualification:- Any Graduate
Batch:- Any Batch
Salary/CTC:- Rs 3.5-4.5 LPA
Apply Now;- http://www.allcoding1.com
Video:- https://youtube.com/shorts/tWPfvbhtPgI?feature=share
Telegram:- @allcoding1
π11π1
def gameWinner(colors):
currPlayer = "wendy"
prevPlayer = ""
winner = ""
while True:
moveMade = False
if currPlayer == "wendy":
whiteIndex = colors.find("www")
if whiteIndex = -1:
# 3 consecutive whites found, remove the middle one
colorsBuilder = list(colors)
colorsBuilder.pop(whiteIndex + 1)
colors = "".join(colorsBuilder)
moveMade = True
prevPlayer = currPlayer
currPlayer = "bob"
else:
blackIndex = colors.find("bbb")
if blackIndex != -1:
# 3 consecutive blacks found, remove the middle one
colorsBuilder = list(colors)
colorsBuilder.pop(blackIndex + 1)
colors = "".join(colorsBuilder)
moveMade = True
prevPlayer = currPlayer
currPlayer = "wendy"
# if no moves possible break
if not moveMade:
winner = prevPlayer
break
return winner
print(gameWinner("wwwbb"))
Python 3
Game Winner
JP Morgan
Telegram:- @allcoding1
currPlayer = "wendy"
prevPlayer = ""
winner = ""
while True:
moveMade = False
if currPlayer == "wendy":
whiteIndex = colors.find("www")
if whiteIndex = -1:
# 3 consecutive whites found, remove the middle one
colorsBuilder = list(colors)
colorsBuilder.pop(whiteIndex + 1)
colors = "".join(colorsBuilder)
moveMade = True
prevPlayer = currPlayer
currPlayer = "bob"
else:
blackIndex = colors.find("bbb")
if blackIndex != -1:
# 3 consecutive blacks found, remove the middle one
colorsBuilder = list(colors)
colorsBuilder.pop(blackIndex + 1)
colors = "".join(colorsBuilder)
moveMade = True
prevPlayer = currPlayer
currPlayer = "wendy"
# if no moves possible break
if not moveMade:
winner = prevPlayer
break
return winner
print(gameWinner("wwwbb"))
Python 3
Game Winner
JP Morgan
Telegram:- @allcoding1
π6
allcoding1
def cardinalitySort(nums): return sorted(nums, key=lambda num: [bin(num).count('1'), num]) Cardinality sorting
#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() {
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++
Telegram:- @allcoding1
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() {
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++
Telegram:- @allcoding1
π6β€1
def minimumCost(price):
n = len(price)
price.append(0)
ans = float('inf')
last = {price[0]: 0}
for i in range(1, n):
v = price[i]
price[i] += price[i - 1]
if last.get(v) != None:
ans = min(ans, price[i] - price[last[v]] + v)
last[v] = i
return ans if ans != float('inf') else -1
n = int(input())
price = list(map(int,input().split(' ')))
print(minimumCost(price))
Python 3
Amazon
Telegram:- @allcoding1
n = len(price)
price.append(0)
ans = float('inf')
last = {price[0]: 0}
for i in range(1, n):
v = price[i]
price[i] += price[i - 1]
if last.get(v) != None:
ans = min(ans, price[i] - price[last[v]] + v)
last[v] = i
return ans if ans != float('inf') else -1
n = int(input())
price = list(map(int,input().split(' ')))
print(minimumCost(price))
Python 3
Amazon
Telegram:- @allcoding1
π11
string getLongestRegex(string a, string b, string c)
{
const size_t n = a.size();
int idx = -1;
for (int i = 0; i < n; i++) {
if (c[i] != a[i] && c[i] != b[i]) { idx = i; }
}
if (idx == -1) return "-1";
string res;
for (int i = 0; i < n; i++) {
if (i == idx) {
string cur = "[";
for (int j = 'A'; j <= 'Z'; j++) if (j != c[i]) cur += j;
cur += "]";
res += cur;
} else {
res += "[ABCDEFGHIJKLMNOPQRSTUVWXYZ]";
}
}
return res;
}
C++
Amazon
Telegram:- @allcoding1
{
const size_t n = a.size();
int idx = -1;
for (int i = 0; i < n; i++) {
if (c[i] != a[i] && c[i] != b[i]) { idx = i; }
}
if (idx == -1) return "-1";
string res;
for (int i = 0; i < n; i++) {
if (i == idx) {
string cur = "[";
for (int j = 'A'; j <= 'Z'; j++) if (j != c[i]) cur += j;
cur += "]";
res += cur;
} else {
res += "[ABCDEFGHIJKLMNOPQRSTUVWXYZ]";
}
}
return res;
}
C++
Amazon
Telegram:- @allcoding1
π13β€1
π―Infosys Hiring Power Programmer
Batch - 2022 and below Batch
Skills Set - Java Full Stack
Apply Now:- career.infosys.com/jobdesc?sourceId=4003&jobReferenceCode=INFSYS-EXTERNAL-160368
Telegram:- @allcoding1
Batch - 2022 and below Batch
Skills Set - Java Full Stack
Apply Now:- career.infosys.com/jobdesc?sourceId=4003&jobReferenceCode=INFSYS-EXTERNAL-160368
Telegram:- @allcoding1
π2
π―Amazon Hiring SME
Batch - 2021/2022/2023
Degree - BE, BSC, MCA, Msc
Apply now:- amazon.jobs/en/jobs/2442412/subject-matter-expert
Telegram:- @allcoding1
Batch - 2021/2022/2023
Degree - BE, BSC, MCA, Msc
Apply now:- amazon.jobs/en/jobs/2442412/subject-matter-expert
Telegram:- @allcoding1
π3β€2π1
π―Optum Walk-in Drive 2023 For Chat Support
Location: Hyderabad
Qualification: Any Graduate
Work Experience: 0 β 1 years
Walk-In Date: 20th October 2023
Apply now:-
https://www.naukri.com/job-listings-walk-in-for-freshers-chat-support-united-health-group-optum-hyderabad-secunderabad-telangana-0-to-1-years-300623004099?source=jobscoupe.com
Telegram:- @allcoding1
Location: Hyderabad
Qualification: Any Graduate
Work Experience: 0 β 1 years
Walk-In Date: 20th October 2023
Apply now:-
https://www.naukri.com/job-listings-walk-in-for-freshers-chat-support-united-health-group-optum-hyderabad-secunderabad-telangana-0-to-1-years-300623004099?source=jobscoupe.com
Telegram:- @allcoding1
π9
π―Tech Mahindra Recruitment 2023 For Customer Service Associate
Location: Bangalore
Qualification: Undergraduate / Graduate / Post Graduate
Work Experience: Freshers / Experience
Apply now:-
https://www.naukri.com/job-listings-tech-mahindra-is-hiring-csa-international-voice-process-bengaluru-tech-mahindra-bangalore-bengaluru-0-to-4-years-091023002447?source=jobscoupe.com
Telegram:- @allcoding1
Location: Bangalore
Qualification: Undergraduate / Graduate / Post Graduate
Work Experience: Freshers / Experience
Apply now:-
https://www.naukri.com/job-listings-tech-mahindra-is-hiring-csa-international-voice-process-bengaluru-tech-mahindra-bangalore-bengaluru-0-to-4-years-091023002447?source=jobscoupe.com
Telegram:- @allcoding1
π3
π―DHL Off Campus Hiring For Software Engineer | Chennai | 4.5 LPA
Job Role : Software Engineer
Education : BE/BTech/MCA/MTech
Job Location : Chennai
Package : 4.5 LPA
Apply Now:- www.allcoding1.com
Telegram:- @allcoding1
Job Role : Software Engineer
Education : BE/BTech/MCA/MTech
Job Location : Chennai
Package : 4.5 LPA
Apply Now:- www.allcoding1.com
Telegram:- @allcoding1
π3
π―Hitachi GlobalLogic Hiring Analyst | Freshers to 2 Years | Any Graduate | 4 LPA
Job Role:-Associate Analyst
Qualification:-Any Graduate
Location:-Chennai
Salary/CTC:-5 LPA
Apply Now:- www.allcoding1.com
Telegram:- @allcoding1
Job Role:-Associate Analyst
Qualification:-Any Graduate
Location:-Chennai
Salary/CTC:-5 LPA
Apply Now:- www.allcoding1.com
Telegram:- @allcoding1
π9