int dfs(vector<pair<int, int>> g[], pair<int, int> disRev[], bool visit[], int u) {
visit[u] = true;
int totalRev = 0;
for (int i = 0; i < g[u].size(); i++) {
int v = g[u][i].first;
if (!visit[v]) {
disRev[v].first = disRev[u].first + 1;
disRev[v].second = disRev[u].second;
if (g[u][i].second) {
disRev[v].second = disRev[u].second + 1;
totalRev++;
}
totalRev += dfs(g, disRev, visit, v);
}
}
return totalRev;
}
int getMinInversions(int e,vector<int>& from, vector<int>& to) {
int V = e + 1;
vector<pair<int, int>> g[V + 1];
pair<int, int> disRev[V + 1];
bool visit[V + 1];
for (int i = 0; i < e; i++) {
int u = from[i];
int v = to[i];
g[u].push_back(make_pair(v, 0));
g[v].push_back(make_pair(u, 1));
}
for (int i = 1; i <= V; i++) {
visit[i] = false;
disRev[i].first = disRev[i].second = 0;
}
int root = 1;
int totalRev = dfs(g, disRev, visit, root);
int res = INT_MAX;
for (int i = 1; i <= V; i++) {
int edgesToRev = (totalRev - disRev[i].second) + (disRev[i].first - disRev[i].second);
if (edgesToRev < res) {
res = edgesToRev;
root = i;
}
}
return res;
}
Neutral Network โ
visit[u] = true;
int totalRev = 0;
for (int i = 0; i < g[u].size(); i++) {
int v = g[u][i].first;
if (!visit[v]) {
disRev[v].first = disRev[u].first + 1;
disRev[v].second = disRev[u].second;
if (g[u][i].second) {
disRev[v].second = disRev[u].second + 1;
totalRev++;
}
totalRev += dfs(g, disRev, visit, v);
}
}
return totalRev;
}
int getMinInversions(int e,vector<int>& from, vector<int>& to) {
int V = e + 1;
vector<pair<int, int>> g[V + 1];
pair<int, int> disRev[V + 1];
bool visit[V + 1];
for (int i = 0; i < e; i++) {
int u = from[i];
int v = to[i];
g[u].push_back(make_pair(v, 0));
g[v].push_back(make_pair(u, 1));
}
for (int i = 1; i <= V; i++) {
visit[i] = false;
disRev[i].first = disRev[i].second = 0;
}
int root = 1;
int totalRev = dfs(g, disRev, visit, root);
int res = INT_MAX;
for (int i = 1; i <= V; i++) {
int edgesToRev = (totalRev - disRev[i].second) + (disRev[i].first - disRev[i].second);
if (edgesToRev < res) {
res = edgesToRev;
root = i;
}
}
return res;
}
Neutral Network โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
class FenwickTree:
def __init__(self, n):
self.n = n
self.tree = [0] * (n + 1)
def update(self, i, delta):
while i <= self.n:
self.tree[i] += delta
i += i & (-i)
def query(self, i):
total = 0
while i > 0:
total += self.tree[i]
i -= i & (-i)
return total
def countSubsequences(arr, l, r):
MOD = 10**9 + 7
values = sorted(set(arr + [l-1, r]))
value_map = {v: i+1 for i, v in enumerate(values)}
ft = FenwickTree(len(value_map))
result = 0
prefix_mex = 0
ft.update(value_map[prefix_mex], 1)
for num in arr:
if num < prefix_mex:
ft.update(value_map[num], 1)
else:
while prefix_mex in value_map and ft.query(value_map[prefix_mex]) > 0:
prefix_mex += 1
if prefix_mex in value_map:
ft.update(value_map[prefix_mex], 1)
left = ft.query(value_map.get(l-1, 0))
right = ft.query(value_map.get(r, 0))
result = (result + (right - left)) % MOD
return result
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Sign Up | LinkedIn
500 million+ members | Manage your professional identity. Build and engage with your professional network. Access knowledge, insights and opportunities.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name : Zerodha
Role : Backend Intern
Batch : 2024
Link : https://careers.zerodhafundhouse.com/jobs/NYRKjkWrqkPN/backend-engineer-internship
Role : Backend Intern
Batch : 2024
Link : https://careers.zerodhafundhouse.com/jobs/NYRKjkWrqkPN/backend-engineer-internship
Zerodhafundhouse
Hiring for Backend Engineer - Internship for Bengaluru - Internship
Posted by : Zerodha Asset Management Pvt Ltd | MongoDB,PYTHON,JAVASCRIPT,NODEJS,Golang
๐1
#include <iostream>BNY FINDPODCOUNT โ
#include <vector>
#include <algorithm>
using namespace std;
void processLogs(int n, vector<int>& pods, int m, const vector<vector<int>>& logs) {
int globalThreshold = 0;
for (const auto& log : logs) {
if (log[0] == 1) {
int p = log[1] - 1;
pods[p] = max(pods[p], x);
if (pods[p] < globalThreshold) {
pods[p] = globalThreshold;
}
} else if (log[0] == 2) {
int x = log[2];
globalThreshold = max(globalThreshold, x);
for (int i = 0; i < n; ++i) {
if (pods[i] < globalThreshold) {
pods[i] = globalThreshold;
}
}
}
}
for (int i = 0; i < n; ++i) {
cout << pods[i] << " ";
}
cout << endl;
}
๐1
#include <bits/stdc++.h>
using namespace std;
int solve(vector<vector<int>>& mat) {
int m = mat.size();
int n = mat[0].size();
vector<vector<int>> dp(m, vector<int>(n, 0));
dp[m-1][n-1] = 1;
for (int j = n - 2; j >= 0; --j) {
dp[m-1][j] = max(1, dp[m-1][j+1] - mat[m-1][j]);
}
for (int i = m - 2; i >= 0; --i) {
dp[i][n-1] = max(1, dp[i+1][n-1] - mat[i][n-1]);
}
for (int i = m - 2; i >= 0; --i) {
for (int j = n - 2; j >= 0; --j) {
int mini = min(dp[i+1][j], dp[i][j+1]);
dp[i][j] = max(1, mini - mat[i][j]);
}
}
return dp[0][0];
}
int main() {
int m, n;
cin >> m >> n;
vector<vector<int>> mat(m, vector<int>(n));
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
cin >> mat[i][j];
}
}
cout << solve(mat) << endl;
return 0;
}
Minimum strength to reach destinationโ
Samsung
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
const int MAXN = 1000;
vector<int> adjA[MAXN + 1];
vector<int> adjB[MAXN + 1];
bool visA[MAXN + 1];
bool visB[MAXN + 1];
void bfs(int s, vector<int> adj[], vector<int>& comp, bool vis[]) {
queue<int> q;
q.push(s);
vis[s] = true;
comp.push_back(s);
while (!q.empty()) {
int u = q.front(); q.pop();
for (int v : adj[u]) {
if (!vis[v]) {
vis[v] = true;
comp.push_back(v);
q.push(v);
}
}
}
}
void findComp(int n, vector<int> adj[], vector<vector<int>>& comps, bool vis[]) {
fill(vis, vis + n + 1, false);
for (int i = 1; i <= n; ++i) {
if (!vis[i]) {
vector<int> comp;
bfs(i, adj, comp, vis);
comps.push_back(comp);
}
}
}
int main() {
int n, m1, m2;
cin >> n >> m1 >> m2;
for (int i = 0; i < m1; ++i) {
int u, v;
cin >> u >> v;
adjA[u].push_back(v);
adjA[v].push_back(u);
}
for (int i = 0; i < m2; ++i) {
int u, v;
cin >> u >> v;
adjB[u].push_back(v);
adjB[v].push_back(u);
}
vector<vector<int>> compsA, compsB;
findComp(n, adjA, compsA, visA);
findComp(n, adjB, compsB, visB);
int numCompA = compsA.size();
int numCompB = compsB.size();
int maxEdges = (numCompA - 1) * (numCompB - 1);
cout << maxEdges << endl;
return 0;
}
Samsung โ
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
using namespace std;
vector<int>f(vector<int>&r,vector<int>&b,int cost){
int n=r.size();
int temp=0;
vector<int>ans;
ans.push_back(temp);
bool flag=true;
for(int i=0;i<n;i++){
if(flag){
if(r[i]<b[i]+cost){
temp+=r[i];
}
else{
temp+=b[i]+cost;
flag=false;
}
}
else{
if(r[i]<b[i]){
temp+=r[i];
flag=true;
}
else{
temp+=b[i];
}
}
ans.push_back(temp);
}
return ans;
}
int main() {
int n;
cin>>n;
vector<int>r(n),b(n);
for(int i=0;i<n;i++){
cin>>r[i];
}
for(int i=0;i<n;i++){
cin>>b[i];
}
int cost;
cin>>cost;
vector<int>ans=f(r,b,cost);
for(auto i:ans)cout<<i<<" ";
return 0;
}
Red Blue
Oracle โ
vector<int>f(vector<int>&r,vector<int>&b,int cost){
int n=r.size();
int temp=0;
vector<int>ans;
ans.push_back(temp);
bool flag=true;
for(int i=0;i<n;i++){
if(flag){
if(r[i]<b[i]+cost){
temp+=r[i];
}
else{
temp+=b[i]+cost;
flag=false;
}
}
else{
if(r[i]<b[i]){
temp+=r[i];
flag=true;
}
else{
temp+=b[i];
}
}
ans.push_back(temp);
}
return ans;
}
int main() {
int n;
cin>>n;
vector<int>r(n),b(n);
for(int i=0;i<n;i++){
cin>>r[i];
}
for(int i=0;i<n;i++){
cin>>b[i];
}
int cost;
cin>>cost;
vector<int>ans=f(r,b,cost);
for(auto i:ans)cout<<i<<" ";
return 0;
}
Red Blue
Oracle โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
PayU is hiring Generative AI intern
For 2024, 2025, 2026 grads
Location: Gurugram
https://jobs.eu.lever.co/payu/98ed6cbf-afa0-4bf6-b4ba-cfb0250ba9e9
For 2024, 2025, 2026 grads
Location: Gurugram
https://jobs.eu.lever.co/payu/98ed6cbf-afa0-4bf6-b4ba-cfb0250ba9e9
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Basware is hiring for Junior Associate Cloud Operations Engineer
Expected Salary: 3-5 LPA
Apply for Basware:
https://emp.jobylon.com/jobs/246944-basware-junior-associate-cloud-operations-engineer-pdf-mapping/
Expected Salary: 3-5 LPA
Apply for Basware:
https://emp.jobylon.com/jobs/246944-basware-junior-associate-cloud-operations-engineer-pdf-mapping/
Jobylon
Junior Associate Cloud Operations Engineer, PDF Mapping
Products and Cloud Engineering & Operations business function is responsible for ensuring that Basware continues to provide its customers with industry leading SaaS solutions to deliver true automation for the CFOโs office. As a global team, they create andโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Walmart is hiring for SOFTWARE ENGINEER II (0-1 years)
Expected Salary: 15-22 LPA
Apply for Walmart:
https://linkedin.com/jobs/view/3993443720/?alternateChannel=search
Expected Salary: 15-22 LPA
Apply for Walmart:
https://linkedin.com/jobs/view/3993443720/?alternateChannel=search
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Ecolab is hiring for Associate Software Engineer
Expected Salary: 7-12 LPA
Apply here:
https://jobs.ecolab.com/global/en/job/EIYEIEUSR00240184EXTERNALENGLOBAL/Associate-Software-Engineer
Expected Salary: 7-12 LPA
Apply here:
https://jobs.ecolab.com/global/en/job/EIYEIEUSR00240184EXTERNALENGLOBAL/Associate-Software-Engineer
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Writesonic is hiring for Software Engineer in Test
Expected Salary: 8-12 LPA
Apply here:
https://recruitcrm.io/apply/17097993350110060526kyH
Expected Salary: 8-12 LPA
Apply here:
https://recruitcrm.io/apply/17097993350110060526kyH
recruitcrm.io
Apply To Software Engineer in Test With Writesonic
โฆ
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Global Payments Inc. is hiring for DevOps Engineer
Expected Stipend: 6-12 LPA
Apply here:
https://linkedin.com/jobs/view/3895020051/?alternateChannel=search
Expected Stipend: 6-12 LPA
Apply here:
https://linkedin.com/jobs/view/3895020051/?alternateChannel=search
Linkedin
Global Payments Inc. hiring DevOps Engineer in Pune, Maharashtra, India | LinkedIn
Posted 9:08:19 AM. Description A strong working knowledge of kubernetes, capacity planning, cluster management, CloudโฆSee this and similar jobs on LinkedIn.
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐ Join Our Team as an HR Business Partner at Amazon Operations! ๐
Are you a strategic HR leader ready to influence and drive organizational effectiveness in a dynamic, 24/7 environment? We're seeking a seasoned HRBP with a passion for shaping HR strategies that align with business goals and foster a high-engagement culture.
Key Responsibilities:
Lead and inspire a team of HR professionals in a high-growth environment.
Design and implement policies that drive continual improvement in business objectives.
Partner with leadership to integrate Amazonโs Leadership Principles into our talent system.
Operate with autonomy to solve problems and craft integrated solutions across the employee lifecycle.
If you're ready to take on a challenging and rewarding role, please send your resume to nesinha@amazon.com. Let's shape the future together!
Are you a strategic HR leader ready to influence and drive organizational effectiveness in a dynamic, 24/7 environment? We're seeking a seasoned HRBP with a passion for shaping HR strategies that align with business goals and foster a high-engagement culture.
Key Responsibilities:
Lead and inspire a team of HR professionals in a high-growth environment.
Design and implement policies that drive continual improvement in business objectives.
Partner with leadership to integrate Amazonโs Leadership Principles into our talent system.
Operate with autonomy to solve problems and craft integrated solutions across the employee lifecycle.
If you're ready to take on a challenging and rewarding role, please send your resume to nesinha@amazon.com. Let's shape the future together!