๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
int N;
vector<pair<ll,ll>> trees;
ll Manhattan(pair<ll,ll> a, pair<ll,ll> b) {
return abs(a.first - b.first) + abs(a.second - b.second);
}
ll findMinDistance() {
sort(trees.begin(), trees.end());
ll minDist = INF;
for(int i = 1; i < N; i++) {
minDist = min(minDist, Manhattan(trees[i], trees[i-1]));
}
return minDist;
}
ll findMaxDistance() {
ll mx1 = -INF, mx2 = -INF, mn1 = INF, mn2 = INF;
for(int i = 0; i < N; i++) {
mx1 = max(mx1, trees[i].first + trees[i].second);
mn1 = min(mn1, trees[i].first + trees[i].second);
mx2 = max(mx2, trees[i].first - trees[i].second);
mn2 = min(mn2, trees[i].first - trees[i].second);
}
return max(mx1 - mn1, mx2 - mn2);
}
void solve() {
ll minMaxDist = INF, maxMinDist = -INF;
for(int i = 0; i < N; i++) {
pair<ll,ll> temp = trees[i];
trees.erase(trees.begin() + i);
minMaxDist = min(minMaxDist, findMaxDistance());
maxMinDist = max(maxMinDist, findMinDistance());
trees.insert(trees.begin() + i, temp);
}
cout << minMaxDist << '\n';
cout << maxMinDist << '\n';
}
int main() {
cin >> N;
trees.resize(N);
for(int i = 0; i < N; i++) {
cin >> trees[i].first >> trees[i].second;
}
solve();
return 0;
}
Maximum and Minimum distance โ
using namespace std;
typedef long long ll;
const ll INF = 1e18;
int N;
vector<pair<ll,ll>> trees;
ll Manhattan(pair<ll,ll> a, pair<ll,ll> b) {
return abs(a.first - b.first) + abs(a.second - b.second);
}
ll findMinDistance() {
sort(trees.begin(), trees.end());
ll minDist = INF;
for(int i = 1; i < N; i++) {
minDist = min(minDist, Manhattan(trees[i], trees[i-1]));
}
return minDist;
}
ll findMaxDistance() {
ll mx1 = -INF, mx2 = -INF, mn1 = INF, mn2 = INF;
for(int i = 0; i < N; i++) {
mx1 = max(mx1, trees[i].first + trees[i].second);
mn1 = min(mn1, trees[i].first + trees[i].second);
mx2 = max(mx2, trees[i].first - trees[i].second);
mn2 = min(mn2, trees[i].first - trees[i].second);
}
return max(mx1 - mn1, mx2 - mn2);
}
void solve() {
ll minMaxDist = INF, maxMinDist = -INF;
for(int i = 0; i < N; i++) {
pair<ll,ll> temp = trees[i];
trees.erase(trees.begin() + i);
minMaxDist = min(minMaxDist, findMaxDistance());
maxMinDist = max(maxMinDist, findMinDistance());
trees.insert(trees.begin() + i, temp);
}
cout << minMaxDist << '\n';
cout << maxMinDist << '\n';
}
int main() {
cin >> N;
trees.resize(N);
for(int i = 0; i < N; i++) {
cin >> trees[i].first >> trees[i].second;
}
solve();
return 0;
}
Maximum and Minimum distance โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
#include<bits/stdc++.h> using namespace std; int F(int x){ int sum = 0; while(x){ sum += x%10; x /= 10; } return sum; } int main() { int a, b, c; cin >> a >> b >> c; int max_x = max(b, c) * pow(9, a) + c; โฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
114,000+ Software Engineer jobs in India (3,962 new)
Todayโs top 114,000+ Software Engineer jobs in India. Leverage your professional network, and get hired. New Software Engineer jobs added daily.
#include<bits/stdc++.h>
using namespace std;
int countOccurrences(int num, int k) {
string numStr = to_string(num);
return count(numStr.begin(), numStr.end(), '0' + k);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int k, n;
cin >> k;
cin >> n;
if(n == 0) {
cout << -1;
return 0;
}
vector<int> arr(n);
for(int i = 0; i < n; i++) {
cin >> arr[i];
}
int maxCount = -1;
int number = 0;
for(int i = 0; i < n; i++) {
int currentCount = countOccurrences(arr[i], k);
if(currentCount > maxCount) {
maxCount = currentCount;
number = arr[i];
}
}
if(maxCount == 0) {
cout << 0;
} else {
cout << number;
}
return 0;
}
C++โ
using namespace std;
int countOccurrences(int num, int k) {
string numStr = to_string(num);
return count(numStr.begin(), numStr.end(), '0' + k);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int k, n;
cin >> k;
cin >> n;
if(n == 0) {
cout << -1;
return 0;
}
vector<int> arr(n);
for(int i = 0; i < n; i++) {
cin >> arr[i];
}
int maxCount = -1;
int number = 0;
for(int i = 0; i < n; i++) {
int currentCount = countOccurrences(arr[i], k);
if(currentCount > maxCount) {
maxCount = currentCount;
number = arr[i];
}
}
if(maxCount == 0) {
cout << 0;
} else {
cout << number;
}
return 0;
}
C++โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
TCS Mega Walk-in Drive
Location: Hyderabad
Qualification: BCom, B.A, BBA, BSc (all streams), BCA, BMS, BAF, BBI
Batch: 2021, 2022 and 2023 batch
Salary: 3.4 LPA (Expected)
Walkin Date: Hyderabad (5th Aug 23)
Drive Venue: TCS Deccan park, Plot No 1, Software Units Layout, Madhapur, Hyderabad, Telangana 500081
Timings: 9 AM to 11 AM
Location: Hyderabad
Qualification: BCom, B.A, BBA, BSc (all streams), BCA, BMS, BAF, BBI
Batch: 2021, 2022 and 2023 batch
Salary: 3.4 LPA (Expected)
Walkin Date: Hyderabad (5th Aug 23)
Drive Venue: TCS Deccan park, Plot No 1, Software Units Layout, Madhapur, Hyderabad, Telangana 500081
Timings: 9 AM to 11 AM
Today anyone give Trilogy innovations OA Exam?
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: beGalileo
Role: Trainee Developer
Batch eligible: 2022 and 2023 grads
Apply: https://www.linkedin.com/jobs/view/3679679513
P.S: Only go if you donโt have any other offers.
Role: Trainee Developer
Batch eligible: 2022 and 2023 grads
Apply: https://www.linkedin.com/jobs/view/3679679513
P.S: Only go if you donโt have any other offers.
Linkedin
beGalileoยฎ hiring Trainee Developer (Fresher) in Bengaluru South, Karnataka, India | LinkedIn
Posted 5:40:50 AM. Trainee-Developer (Fresher) is someone with basic foundation in software development & at least oneโฆSee this and similar jobs on LinkedIn.
#include <bits/stdc++.h>
#include <boost/icl/interval_set.hpp>
using namespace std;
vector<long long> solution(vector<vector<long long>>& chunks) {
boost::icl::interval_set<long long> receivedBytes;
vector<long long> result;
for(auto &chunk: chunks) {
receivedBytes.insert(boost::icl::discrete_interval<long long>::closed(chunk[0], chunk[1]));
result.push_back(boost::icl::length(receivedBytes) - receivedBytes.iterative_size() + 1);
}
return result;
}
int main() {
vector<vector<long long>> chunks = {{1, 9}, {1, 3}, {8, 15}, {6, 9}, {2, 3}};
vector<long long> result = solution(chunks);
for(auto res: result)
cout << res << ' ';
cout << '\n';
return 0;
}
Counting Unique Bytes in Overlapping File Chunk
C++โ
#include <boost/icl/interval_set.hpp>
using namespace std;
vector<long long> solution(vector<vector<long long>>& chunks) {
boost::icl::interval_set<long long> receivedBytes;
vector<long long> result;
for(auto &chunk: chunks) {
receivedBytes.insert(boost::icl::discrete_interval<long long>::closed(chunk[0], chunk[1]));
result.push_back(boost::icl::length(receivedBytes) - receivedBytes.iterative_size() + 1);
}
return result;
}
int main() {
vector<vector<long long>> chunks = {{1, 9}, {1, 3}, {8, 15}, {6, 9}, {2, 3}};
vector<long long> result = solution(chunks);
for(auto res: result)
cout << res << ' ';
cout << '\n';
return 0;
}
Counting Unique Bytes in Overlapping File Chunk
C++โ
#include<bits/stdc++.h>
using namespace std;
int minWealthDifference(vector<int>& c) {
int totalWealth = accumulate(c.begin(), c.end(), 0);
int n = c.size();
int offset = n*10000;
vector<vector<bool>> dp(n+1, vector<bool>(2*offset+1, false));
dp[0][offset] = true;
for(int i = 0; i < n; ++i){
for(int j = i; j >= 0; --j){
for(int k = 0; k <= 2*offset; ++k){
if(dp[j][k]) {
dp[j+1][k+c[i]] = true;
}
}
}
}
int result = INT_MAX;
for(int i = 0; i <= 2*offset; ++i){
if(dp[n/2][i]) {
result = min(result, abs(totalWealth - 2*(i - offset)));
}
}
return result;
}
int main() {
int n;
cin >> n;
vector<int> c(n);
for(int i = 0; i < n; ++i){
cin >> c[i];
}
cout <<minWealthDifference(c) << "\n";
return 0;
}
NATURE
C++โ
using namespace std;
int minWealthDifference(vector<int>& c) {
int totalWealth = accumulate(c.begin(), c.end(), 0);
int n = c.size();
int offset = n*10000;
vector<vector<bool>> dp(n+1, vector<bool>(2*offset+1, false));
dp[0][offset] = true;
for(int i = 0; i < n; ++i){
for(int j = i; j >= 0; --j){
for(int k = 0; k <= 2*offset; ++k){
if(dp[j][k]) {
dp[j+1][k+c[i]] = true;
}
}
}
}
int result = INT_MAX;
for(int i = 0; i <= 2*offset; ++i){
if(dp[n/2][i]) {
result = min(result, abs(totalWealth - 2*(i - offset)));
}
}
return result;
}
int main() {
int n;
cin >> n;
vector<int> c(n);
for(int i = 0; i < n; ++i){
cin >> c[i];
}
cout <<minWealthDifference(c) << "\n";
return 0;
}
NATURE
C++โ
int solution(vector<int> arr, int src, int dest) {
map<int,int> visA, visB;
int start = arr[src];
int curr = 1;
set<int> s;
for(auto &x: arr){
s.insert(x);
}
while(visA[start] == 0){
visA[start] = curr;
curr++;
start = arr[start];
if(start == -1){
break;
}
}
start = arr[dest];
while(visB[start] == 0){
visB[start] = curr;
curr++;
start = arr[start];
if(start == -1){
break;
}
}
vector<pair<int,int>> vp;
for(auto &x: s){
if(visA[x] != 0 && visB[x] != 0){
pair<int,int> p = {visA[x] + visB[x], x};
vp.push_back(p);
}
}
sort(vp.begin(), vp.end());
return vp[0].second;
}
Juspay Largest Sum Cycle
C++โ
map<int,int> visA, visB;
int start = arr[src];
int curr = 1;
set<int> s;
for(auto &x: arr){
s.insert(x);
}
while(visA[start] == 0){
visA[start] = curr;
curr++;
start = arr[start];
if(start == -1){
break;
}
}
start = arr[dest];
while(visB[start] == 0){
visB[start] = curr;
curr++;
start = arr[start];
if(start == -1){
break;
}
}
vector<pair<int,int>> vp;
for(auto &x: s){
if(visA[x] != 0 && visB[x] != 0){
pair<int,int> p = {visA[x] + visB[x], x};
vp.push_back(p);
}
}
sort(vp.begin(), vp.end());
return vp[0].second;
}
Juspay Largest Sum Cycle
C++โ
int solution(vector<int>arr){
int ans=INT_MIN;
int result=-1;
vector<int>weight(arr.size(),0);
for(int i=0;i<arr.size();i++){
int source=i;
int dest=arr[i];
if(dest!=-1){
weight[dest]+=source;
if(ans<=weight[dest]){
ans=max(ans,weight[dest]);
result=dest;
}
}
}
if(ans!=INT_MIN)
return result;
return -1;
}
Juspay Maximum Weight Node C++โ
int ans=INT_MIN;
int result=-1;
vector<int>weight(arr.size(),0);
for(int i=0;i<arr.size();i++){
int source=i;
int dest=arr[i];
if(dest!=-1){
weight[dest]+=source;
if(ans<=weight[dest]){
ans=max(ans,weight[dest]);
result=dest;
}
}
}
if(ans!=INT_MIN)
return result;
return -1;
}
Juspay Maximum Weight Node C++โ
int leastCommonDescendent(int nodes[], int N, int node1, int node2) {
int *visited = new int [N];
int cnt1 = 0;
int cnt2 = 0;
int mark = node1;
if(node1 == node2) return node2;
for(int i = 0; i < N; i++){
visited[i] = 0;
}
while((nodes[node1] != node1) && (nodes[node1] != -1) && (visited[node1] == 0) && (node1 != node2)){
visited[node1]++;
node1 = nodes[node1];
cnt1++;
}
visited[node1]++;
while((nodes[node2] != node2) && (nodes[node2] != -1) && (visited[node2] != 2) && (node1 != node2)){
visited[node2]++;
node2 = nodes[node2];
cnt2++;
}
if(node1 != node2) return -1;
if ((nodes[node1] == -1) && (visited[node2] == 1)) return -1;
if(nodes[node2] == -1) return -1;
if(cnt1 > cnt2)
return node2;
else
return mark;
}
Juspay Nearest Meeting Cell
C++โ
int *visited = new int [N];
int cnt1 = 0;
int cnt2 = 0;
int mark = node1;
if(node1 == node2) return node2;
for(int i = 0; i < N; i++){
visited[i] = 0;
}
while((nodes[node1] != node1) && (nodes[node1] != -1) && (visited[node1] == 0) && (node1 != node2)){
visited[node1]++;
node1 = nodes[node1];
cnt1++;
}
visited[node1]++;
while((nodes[node2] != node2) && (nodes[node2] != -1) && (visited[node2] != 2) && (node1 != node2)){
visited[node2]++;
node2 = nodes[node2];
cnt2++;
}
if(node1 != node2) return -1;
if ((nodes[node1] == -1) && (visited[node2] == 1)) return -1;
if(nodes[node2] == -1) return -1;
if(cnt1 > cnt2)
return node2;
else
return mark;
}
Juspay Nearest Meeting Cell
C++โ
๐1
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int64_t n, m, k; cin >> n >> m >> k;
vector<pair<int64_t, int64_t>> pts(k);
for (auto &[x, y] : pts)
cin >> x >> y;
int64_t r; cin >> r;
int64_t t; cin >> t;
int64_t rt = r*t;
int64_t cnt = 0;
for (int64_t x = 0; x <= n; x++) {
for (int64_t y = 0; y <= n; y++) {
bool burn = 0;
for (auto [fx, fy] : pts) {
auto dx = x - fx;
auto dy = y - fy;
auto ri = dx*dx + dy*dy;
if (ri <= rt*rt) { burn = 1; break; }
}
// cout << x << " " << y << endl;
if (!burn) cnt++;
}
}
cout << cnt << endl;
}
Spreading fire
Intuitโ
using namespace std;
int main ()
{
int64_t n, m, k; cin >> n >> m >> k;
vector<pair<int64_t, int64_t>> pts(k);
for (auto &[x, y] : pts)
cin >> x >> y;
int64_t r; cin >> r;
int64_t t; cin >> t;
int64_t rt = r*t;
int64_t cnt = 0;
for (int64_t x = 0; x <= n; x++) {
for (int64_t y = 0; y <= n; y++) {
bool burn = 0;
for (auto [fx, fy] : pts) {
auto dx = x - fx;
auto dy = y - fy;
auto ri = dx*dx + dy*dy;
if (ri <= rt*rt) { burn = 1; break; }
}
// cout << x << " " << y << endl;
if (!burn) cnt++;
}
}
cout << cnt << endl;
}
Spreading fire
Intuitโ
๐1
#include <stdio.h>
#include <stdlib.h>
int min(int x, int y) { return x < y ? x : y; }
int max(int x, int y) { return x > y ? x : y; }
int n, m, t, fx, fy, ix, iy, jx, jy;
int vis[1005][1005];
bool solve(int x, int y, int t)
{
if (x < 0 || y < 0) return 0;
if (x >= m || y >= m) return 0;
if (abs(x-fx) + abs(y - fy) <= t) return 0;
if (x == jx && y == jy) return 1;
if (vis[x][y] <= t) return 0;
vis[x][y] = t;
return solve(x+1, y, t+1) solve(x-1, y, t+1) solve(x, y+1, t+1) || solve(x, y-1, t+1);
}
int main() {
scanf("%d %d", &n, &m);
scanf("%d", &t);
while (t--) {
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= m; j++) {
vis[i][j] = 0x3f3f3f3f;
}
}
scanf("%d %d %d %d %d %d", &fx, &fy, &ix, &iy, &jx, &jy);
bool res = solve(ix, ix, 0);
if (!res) {
printf("NO\n");
} else {
printf("YES\n");
}
}
return 0;
}
Circus Fire 1โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: SkilledSearchers
Role: Engineer Trainee
Batch eligible: 2023 grads (Electrical, Chemical, Instrumentation branches)
If interested, send your resume at recruitment@skilledsearchers.com
Role: Engineer Trainee
Batch eligible: 2023 grads (Electrical, Chemical, Instrumentation branches)
If interested, send your resume at recruitment@skilledsearchers.com
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Paytm
Role: Data Science Intern
Batch eligible: 2023 grads only
Apply: https://jobs.lever.co/paytm/9c962cb8-8d38-46fe-b9f4-e3323dddb825
Role: Data Science Intern
Batch eligible: 2023 grads only
Apply: https://jobs.lever.co/paytm/9c962cb8-8d38-46fe-b9f4-e3323dddb825
jobs.lever.co
Paytm - Data Science (WL Operations) - Intern
About Us: Paytm is India's payment Super App offering consumers and merchants most comprehensive payment services. Pioneer of the mobile QR payments revolution in India, Paytmโs mission is to bring half a billion Indians into the mainstream economy throughโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Klimb.io
Role: FullStack Developer Internship
Batch eligible: 2023 and 2024 grads
Tech Stack: NodeJS, MongoDB, Angular, C/C++
Apply: https://bit.ly/45dDuZC
Company Name: BUSY Infotech
Role: Backend Developer Internship
Batch eligible: 2024 grads
Tech Stack: Python, Javascript, MySQL
Apply: https://bit.ly/3rXA137
Company Name: Whitecarrot
Role: FullStack Developer Internship
Batch eligible: 2024 grads
Tech Stack: NodeJS, TypeScript, HTML and CSS
Apply: https://bit.ly/47e8Lxl
P.S: Only go if you have knowledge of mentioned tech stack.
Role: FullStack Developer Internship
Batch eligible: 2023 and 2024 grads
Tech Stack: NodeJS, MongoDB, Angular, C/C++
Apply: https://bit.ly/45dDuZC
Company Name: BUSY Infotech
Role: Backend Developer Internship
Batch eligible: 2024 grads
Tech Stack: Python, Javascript, MySQL
Apply: https://bit.ly/3rXA137
Company Name: Whitecarrot
Role: FullStack Developer Internship
Batch eligible: 2024 grads
Tech Stack: NodeJS, TypeScript, HTML and CSS
Apply: https://bit.ly/47e8Lxl
P.S: Only go if you have knowledge of mentioned tech stack.
cuvette.tech
Fullstack Developer Internship in Klimb.io at Mumbai, Maharashtra, India | Cuvette
Apply For Fullstack Developer Internship | Skills required are NodeJs, MongoDB | Stipend โน12K-15K | FULL-TIME INTERNSHIP | Location is Work from Home
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Google Docs
Juniper referral form
Batch- 2022 or before
Juniper is hiring QA engineers. So please fill the form.
Job Description-
โข Bachelorโs degree in mathematics, Computer Science, Business or Statistics
โข 1.5 + yearโs experience as data analyst
โข โฆ
Juniper is hiring QA engineers. So please fill the form.
Job Description-
โข Bachelorโs degree in mathematics, Computer Science, Business or Statistics
โข 1.5 + yearโs experience as data analyst
โข โฆ
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Jupiter Money is hiring for Data Analyst-I and Data Analyst-III positions.
Do fill in the below form if you are interested
https://docs.google.com/forms/d/e/1FAIpQLSeSibkSUWEY1seRExMdSbsqJ5QQVK7H_2OrsPBZsTCGmgbruA/viewform
Do fill in the below form if you are interested
https://docs.google.com/forms/d/e/1FAIpQLSeSibkSUWEY1seRExMdSbsqJ5QQVK7H_2OrsPBZsTCGmgbruA/viewform
๐2
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
CloudyML is hiring Data Science /Analyst Interns
Minimum 3 months
Requirements : python,sql,powerbi,deep machine Learning ,excel
Apply Link :
https://docs.google.com/forms/d/e/1FAIpQLSeh2l9vDP1WOd7cteRJt7RPlCImAQVD8PVE5WiN8ZaTQxZeHA/viewform
Minimum 3 months
Requirements : python,sql,powerbi,deep machine Learning ,excel
Apply Link :
https://docs.google.com/forms/d/e/1FAIpQLSeh2l9vDP1WOd7cteRJt7RPlCImAQVD8PVE5WiN8ZaTQxZeHA/viewform
Linkedin
CloudyML | LinkedIn
CloudyML | 11,803 followers on LinkedIn. Let's do Hands-on learning | We provide Data Science & Analytics courses for complete Hands-on Practical Learning Experience with Personal Chat Support For Doubt Clearance Everyday.
๐1