#include<bits/stdc++.h>
using namespace std;
void dfs(int node, vector<int>& vis, vector<vector<int>>& adj) {
vis[node] = 1;
for(auto it : adj[node]) {
if(!vis[it]) {
dfs(it, vis, adj);
}
}
}
int main() {
int n, m;
cin >> n >> m;
vector<vector<int>> adj(n);
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
int x;
cin >> x;
if(x == 1) {
adj[i].push_back(j);
adj[j].push_back(i);
}
}
}
vector<int> vis(n, 0);
int cc = 0;
for(int i = 0; i < n; i++) {
if(!vis[i]) {
dfs(i, vis, adj);
cc++;
}
}
cout << cc << endl;
return 0;
}
using namespace std;
void dfs(int node, vector<int>& vis, vector<vector<int>>& adj) {
vis[node] = 1;
for(auto it : adj[node]) {
if(!vis[it]) {
dfs(it, vis, adj);
}
}
}
int main() {
int n, m;
cin >> n >> m;
vector<vector<int>> adj(n);
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
int x;
cin >> x;
if(x == 1) {
adj[i].push_back(j);
adj[j].push_back(i);
}
}
}
vector<int> vis(n, 0);
int cc = 0;
for(int i = 0; i < n; i++) {
if(!vis[i]) {
dfs(i, vis, adj);
cc++;
}
}
cout << cc << endl;
return 0;
}
Walmart Round 2 Result Out check out now
int getMinOperations(vector<int> arr) {
int n=arr.size();
int operations = 0;
for (int i = 1; i < n - 1; i++)
{
if (arr[i] < 0 && arr[i - 1] < 0)
{
arr[i] = 1e9;
operations++;
}
else if (arr[i] < 0 && arr[i - 1] > 0 && arr[i + 1] > 0)
{
if ((arr[i] + arr[i - 1] < 0) || (arr[i] + arr[i + 1] < 0))
{
arr[i] = 1e9;
operations++;
}
}
}
return operations;
}
Make The Array Postive โ
int n=arr.size();
int operations = 0;
for (int i = 1; i < n - 1; i++)
{
if (arr[i] < 0 && arr[i - 1] < 0)
{
arr[i] = 1e9;
operations++;
}
else if (arr[i] < 0 && arr[i - 1] > 0 && arr[i + 1] > 0)
{
if ((arr[i] + arr[i - 1] < 0) || (arr[i] + arr[i + 1] < 0))
{
arr[i] = 1e9;
operations++;
}
}
}
return operations;
}
Make The Array Postive โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Walk Drive
Only Batch Eligible 2022/2023
Only Batch Eligible 2022/2023
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Hi All,
We are looking for MTech Computer science/Electronics 2023/2022 passouts to work with our Cloud Team in Bangalore. We are doing a hiring event on 30th Jan 2024 to hire folks . If interested please share your resume to aayushar@qti.qualcomm.com
We are looking for MTech Computer science/Electronics 2023/2022 passouts to work with our Cloud Team in Bangalore. We are doing a hiring event on 30th Jan 2024 to hire folks . If interested please share your resume to aayushar@qti.qualcomm.com
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
EY is on the lookout for Chartered Accountants (with 0-1 year of experience) to join Indirect Tax team.
Candidates should be based in Pune or willing to relocate.
If you're seeking an opportunity that offers growth, learning, and a chance to be part of a renowned global organization, we'd like to connect with you.
You may email your resume at shweta.patni@in.ey.com and take a step towards a rewarding career with EY!
Candidates should be based in Pune or willing to relocate.
If you're seeking an opportunity that offers growth, learning, and a chance to be part of a renowned global organization, we'd like to connect with you.
You may email your resume at shweta.patni@in.ey.com and take a step towards a rewarding career with EY!
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Hello Freshers,
Mirrar is hiring for the below Internship roles :
1.Frontend Intern
2.Backend Intern
3.Testing Intern
If you are interested in being a part of a B2B fashion tech organization with focus on Augmented Reality, Kindly share your resume to jeevitha.m@mirrar.com
Mirrar is hiring for the below Internship roles :
1.Frontend Intern
2.Backend Intern
3.Testing Intern
If you are interested in being a part of a B2B fashion tech organization with focus on Augmented Reality, Kindly share your resume to jeevitha.m@mirrar.com
long long solution(const vector<int> &no_adjacent, const vector<int> &one_adjacent, const vector<int> &both_adjacent) {
const int n = no_adjacent.size();
vector<long long> dp = {no_adjacent[0], one_adjacent[0]};
for (int i = 2; i < n; ++i) {
dp = {
max(dp[0] + one_adjacent[i - 1], dp[1] + no_adjacent[i - 1]),
max(dp[0] + both_adjacent[i - 1], dp[1] + one_adjacent[i - 1])
};
}
return max(dp[0] + one_adjacent[n - 1], dp[1] + no_adjacent[n - 1]);
}
Efficient Deploymentsโ
const int n = no_adjacent.size();
vector<long long> dp = {no_adjacent[0], one_adjacent[0]};
for (int i = 2; i < n; ++i) {
dp = {
max(dp[0] + one_adjacent[i - 1], dp[1] + no_adjacent[i - 1]),
max(dp[0] + both_adjacent[i - 1], dp[1] + one_adjacent[i - 1])
};
}
return max(dp[0] + one_adjacent[n - 1], dp[1] + no_adjacent[n - 1]);
}
Efficient Deploymentsโ
from functools import cmp_to_key
def romanToInt(s):
rtoi = {'I': 1, 'V': 5, 'X': 10, 'L': 50}
length = len(s)
value = 0
for i in range(length-1):
if (rtoi[s[i]] >= rtoi[s[i+1]]):
value += rtoi[s[i]]
else:
value -= rtoi[s[i]]
value += rtoi[s[length-1]]
return value
def compare(name1, name2):
namelst1 = name1.split()
namelst2 = name2.split()
if (namelst1[0] < namelst2[0]):
return -1
elif (namelst1[0] > namelst2[0]):
return 1
else:
roman1 = romanToInt(namelst1[1])
roman2 = romanToInt(namelst2[1])
if (roman1 < roman2):
return -1
elif (roman1 > roman2):
return 1
return 0
def func(names):
return sorted(names, key=cmp_to_key(compare))
Sort Roman numeralโ
def romanToInt(s):
rtoi = {'I': 1, 'V': 5, 'X': 10, 'L': 50}
length = len(s)
value = 0
for i in range(length-1):
if (rtoi[s[i]] >= rtoi[s[i+1]]):
value += rtoi[s[i]]
else:
value -= rtoi[s[i]]
value += rtoi[s[length-1]]
return value
def compare(name1, name2):
namelst1 = name1.split()
namelst2 = name2.split()
if (namelst1[0] < namelst2[0]):
return -1
elif (namelst1[0] > namelst2[0]):
return 1
else:
roman1 = romanToInt(namelst1[1])
roman2 = romanToInt(namelst2[1])
if (roman1 < roman2):
return -1
elif (roman1 > roman2):
return 1
return 0
def func(names):
return sorted(names, key=cmp_to_key(compare))
Sort Roman numeralโ
import bisect
import functools
def jobScheduling(pickUp, drop, tip):
jobs = sorted(zip(pickup, drop, tip), key=lambda v: v[1])
print(jobs)
dp = [[0, 0]]
for s, e, p in jobs:
i = bisect.bisect(dp, [s + 1]) - 1
if dp[i][1] + e-s+p > dp[-1][1]:
dp.append([e, dp[i][1] + e-s+p])
return dp[-1][1]
Maximum Earnings โ
import functools
def jobScheduling(pickUp, drop, tip):
jobs = sorted(zip(pickup, drop, tip), key=lambda v: v[1])
print(jobs)
dp = [[0, 0]]
for s, e, p in jobs:
i = bisect.bisect(dp, [s + 1]) - 1
if dp[i][1] + e-s+p > dp[-1][1]:
dp.append([e, dp[i][1] + e-s+p])
return dp[-1][1]
Maximum Earnings โ
int findSuitableLocations(vector<int>& centers, int d) {
sort(centers.begin(), centers.end());
auto totalDistance = [¢ers](int x) {
int totalDist = 0;
for (int center : centers) {
totalDist += 2 * abs(center - x);
}
return totalDist;
};
int median_index = centers.size() / 2;
int median = centers[median_index];
int left = median, right = median;
while (totalDistance(left) <= d) {
left -= 1;
}
while (totalDistance(right) <= d) {
right += 1;
}
return max(0, right - left - 1);
}
Amazon โ
sort(centers.begin(), centers.end());
auto totalDistance = [¢ers](int x) {
int totalDist = 0;
for (int center : centers) {
totalDist += 2 * abs(center - x);
}
return totalDist;
};
int median_index = centers.size() / 2;
int median = centers[median_index];
int left = median, right = median;
while (totalDistance(left) <= d) {
left -= 1;
}
while (totalDistance(right) <= d) {
right += 1;
}
return max(0, right - left - 1);
}
Amazon โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
โ๏ธAptean Off Campus Drive 2023 for Associate Engineer | 2023 Batch | 3-5 LPAโ๏ธ
๐จโ๐ป Job Role : Associate Engineer
๐Qualification : B.E/B.Tech
๐Batch : 2023
๐ฐPackage : 3-5 LPA*
โญ๏ธ Apply Fast
https://forms.office.com/pages/responsepage.aspx?id=sMIOVgzfjE6YSKFXGIY7tiekF4ruqbRMj63ry5uRorhUMklMSEZXTk1SQk1WQzhYSEY0Q1FLRk5WNS4u
๐จโ๐ป Job Role : Associate Engineer
๐Qualification : B.E/B.Tech
๐Batch : 2023
๐ฐPackage : 3-5 LPA*
โญ๏ธ Apply Fast
https://forms.office.com/pages/responsepage.aspx?id=sMIOVgzfjE6YSKFXGIY7tiekF4ruqbRMj63ry5uRorhUMklMSEZXTk1SQk1WQzhYSEY0Q1FLRk5WNS4u
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐ฏ Hack Diva By Accenture. Only For Women. Great Opportunity Chance for Women.
โญ๏ธ Apply Link : https://indiacampus.accenture.com/events/hackdiva/
โญ๏ธ Apply Link : https://indiacampus.accenture.com/events/hackdiva/
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Thales
Role: Software Engineer Intern
Batch eligible: 2023 and 2024 passouts only
Apply: https://careers.thalesgroup.com/global/en/job/TGPTGWGLOBALR0234106EXTERNALENGLOBAL/Software-Engineer-Intern%E2%80%A6
Role: Software Engineer Intern
Batch eligible: 2023 and 2024 passouts only
Apply: https://careers.thalesgroup.com/global/en/job/TGPTGWGLOBALR0234106EXTERNALENGLOBAL/Software-Engineer-Intern%E2%80%A6
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Kalvium is hiring for Full Stack Developer Intern
Stipend: 15k-30k per month
๐Apply here: https://kalvium.keka.com/careers/jobdetails/40917
๐Airbus is hiring for Cyber Security Intern
Expected Stipend: 20k-40k per month
๐Apply here: https://ag.wd3.myworkdayjobs.com/en-US/Airbus/job/Bangalore-Area/Cyber-Security-Intern_JR10243209-1
Stipend: 15k-30k per month
๐Apply here: https://kalvium.keka.com/careers/jobdetails/40917
๐Airbus is hiring for Cyber Security Intern
Expected Stipend: 20k-40k per month
๐Apply here: https://ag.wd3.myworkdayjobs.com/en-US/Airbus/job/Bangalore-Area/Cyber-Security-Intern_JR10243209-1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐ #HiringAlert
We are seeking bright and motivated individuals with a demonstrated aptitude for problem-solving ๐จโ๐ป ๐ฉโ๐ป
Required Technology Stack: Node.js, React.js, JavaScript, MySQL, MongoDB.
This internship program spans six months (Remote), offering a stipend of 25,000 INR. Upon successful completion of the internship, candidates may be extended a Pre-Placement Offer (PPO) with a competitive Compensation Package (CTC) of 12 Lakhs Per Annum.
Looking for individuals from IIT, IIIT, NIT or equivalent.
Kindly share your resume at mubina.parveen@sundaylabs.io
We are seeking bright and motivated individuals with a demonstrated aptitude for problem-solving ๐จโ๐ป ๐ฉโ๐ป
Required Technology Stack: Node.js, React.js, JavaScript, MySQL, MongoDB.
This internship program spans six months (Remote), offering a stipend of 25,000 INR. Upon successful completion of the internship, candidates may be extended a Pre-Placement Offer (PPO) with a competitive Compensation Package (CTC) of 12 Lakhs Per Annum.
Looking for individuals from IIT, IIIT, NIT or equivalent.
Kindly share your resume at mubina.parveen@sundaylabs.io
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Position : Node.js Developer Trainee (Fresher)
Role: Backend Developer
Location: Madurai
Batch 2020-2023 Only
https://docs.google.com/forms/d/e/1FAIpQLScFfGBvnO1sza-O-4yAq6k4Y-NkY7--hXDJaRVM9RHcsQbsrw/viewform?pli=1
Role: Backend Developer
Location: Madurai
Batch 2020-2023 Only
https://docs.google.com/forms/d/e/1FAIpQLScFfGBvnO1sza-O-4yAq6k4Y-NkY7--hXDJaRVM9RHcsQbsrw/viewform?pli=1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Uber is Hiring !!
Role: Software Engineering, UberStar Intern
Batch: 2026
๐Apply here: https://university-uber.icims.com/jobs/128166/job
Role: Software Engineering, UberStar Intern
Batch: 2026
๐Apply here: https://university-uber.icims.com/jobs/128166/job
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐SymphonyAI is Hiring !!
Role: QA - Internship
Batch: 2024/2025
Good knowledge of Python/DSA required.
๐Apply here: https://jobs.symphonyai.com/jobs/1512
Role: QA - Internship
Batch: 2024/2025
Good knowledge of Python/DSA required.
๐Apply here: https://jobs.symphonyai.com/jobs/1512