c++
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll mod = 1e9 + 7, cc_total = 0;
void dfs(vector<ll> adj[], vector<bool> &visited, ll src)
{
if (visited[src])
return;
cc_total++;
// cout << src << " " << cc_total << " vis\n";
visited[src] = true;
for (auto i : adj[src])
{
dfs(adj, visited, i);
}
}
void solve()
{
int n, m, x, y, total = 0, cap = 1;
cin >> n >> m;
vector<ll> adj[n + 1];
vector<bool> visited(n + 1, false);
// for (int i = 1; i <= n; i++)
// {
// adj[i].push_back(i);
// }
for (int i = 0; i < m; i++)
{
cin >> x >> y;
adj[x].push_back(y);
adj[y].push_back(x); // for undirected
}
for (int j=1; j<=n; j++)
{
// for (auto j : i)
{
if (!visited[j])
{
cc_total = 0;
dfs(adj, visited, j);
total++;
cap = (cc_total*cap)%mod;
total %= mod;
// cout << endl;
cc_total = 0;
}
}
}
cout << total << " " << cap << "\n";
}
int main()
{
int t = 1;
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
cin >> t;
while (t--)
{
solve();
}
return 0;
}
Fire Escape Routesโ
#include <bits/stdc++.h>
using namespace std;
int solve(const string& str) {
if (str.empty()) return -2;
int maxInt = -1;
int currentNumber = 0;
bool hasNumber = false;
for (char ch : str) {
if (isdigit(ch)) {
currentNumber = currentNumber * 10 + (ch - '0');
hasNumber = true;
} else {
if (hasNumber) {
maxInt = max(maxInt, currentNumber);
currentNumber = 0;
hasNumber = false;
}
}
}
if (hasNumber) {
maxInt = max(maxInt, currentNumber);
}
return maxInt == -1 ? -1 : maxInt;
}
int main() {
int n;
cin >> n;
cin.ignore();
string str;
getline(cin, str);
cout << solve(str) << endl;
return 0;
}
identify maxium integere in string โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
import heapq def finalIndex(N, A): dist = [float('inf')] * (N + 2) dist[N] = 1 dist[N + 1] = 0 pq = [(1, N)] while pq: d, node = heapq.heappop(pq) if d > dist[node]: continue if node ==โฆ
def solve(N, A):
dp = [float('inf')] * (N + 2)
dp[N + 1] = 0
for i in range(N, 0, -1):
dp[i] = 1 + min(dp[i + 1], dp[A[i - 1]])
return sum(dp[1:N+1])
N = int(input())
A = list(map(int, input().split()))
print(solve(N, A))
Final index โ
dp = [float('inf')] * (N + 2)
dp[N + 1] = 0
for i in range(N, 0, -1):
dp[i] = 1 + min(dp[i + 1], dp[A[i - 1]])
return sum(dp[1:N+1])
N = int(input())
A = list(map(int, input().split()))
print(solve(N, A))
Final index โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
MongoDB is hiring Data Engineer intern
For 2024, 2025 grads
Location: Gurugram
https://www.mongodb.com/careers/jobs/6075710
For 2024, 2025 grads
Location: Gurugram
https://www.mongodb.com/careers/jobs/6075710
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Murf AI is hiring SWE
For 2021, 2022, 2023 grads
Location: Bangalore
https://www.linkedin.com/jobs/view/3997731217
For 2021, 2022, 2023 grads
Location: Bangalore
https://www.linkedin.com/jobs/view/3997731217
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Southworks is hiring SWE(Full-stack)
For 2021, 2022, 2023 grads
Location: Remote
https://boards.eu.greenhouse.io/southworks/jobs/4374587101
For 2021, 2022, 2023 grads
Location: Remote
https://boards.eu.greenhouse.io/southworks/jobs/4374587101
job-boards.eu.greenhouse.io
SOUTHWORKS
<h2 data-type="unstyled" data-id="ab490d97-ae9b-43df-87cd-bfc59d954ec4"><strong data-type="bold">Come shape the future of tech </strong></h2>
<p class="x_xmsonormal"><strong>SOUTHWORKS is the pioneer of Development on Demand</strong>, the new model for nearshoreโฆ
<p class="x_xmsonormal"><strong>SOUTHWORKS is the pioneer of Development on Demand</strong>, the new model for nearshoreโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Securiti is hiring SDE
For 2023, 2024 grads
Location: Bangalore
https://www.linkedin.com/jobs/view/3995834639
For 2023, 2024 grads
Location: Bangalore
https://www.linkedin.com/jobs/view/3995834639
Linkedin
Securiti hiring Java Software Engineer in Bengaluru, Karnataka, India | LinkedIn
Posted 12:29:10 PM. Company Description Securiti is a pioneering company known for the Data Command Center, a platformโฆSee this and similar jobs on LinkedIn.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
โค1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Google Cloud on LinkedIn: #ai #genaiexchange #googlecloud | 15 comments
The next chapter of #AI innovation in India is here! ๐ฎ๐ณ
Introducing the #GenAIExchange Hackathon by Google India, supported by Startup India and MeitYโฆ | 15 comments on LinkedIn
Introducing the #GenAIExchange Hackathon by Google India, supported by Startup India and MeitYโฆ | 15 comments on LinkedIn
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Job Application for Cautio
https://docs.google.com/forms/d/e/1FAIpQLSdutIYxjH7GZ9T1_FAPRzCSYpFKIhIAST-XgzODaAibr2Lb_g/viewform
https://docs.google.com/forms/d/e/1FAIpQLSdutIYxjH7GZ9T1_FAPRzCSYpFKIhIAST-XgzODaAibr2Lb_g/viewform
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Exotel hiring for SDE l role
0 - 1 year experience
12 - 24 LPA
https://exotel.com/careers/#op-634728-sde1-platform-engineering
0 - 1 year experience
12 - 24 LPA
https://exotel.com/careers/#op-634728-sde1-platform-engineering
Exotel
Careers
Don't find a job but find a career at Exotel. We believe in working with the absolute best and having fun while we do the best work of our lives.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Ciena hiring Java Developer ( Fresher )
2024/2023/2022 passouts eligible
Upto 12 LPA
Link : https://ciena.wd5.myworkdayjobs.com/en-US/Careers/job/Remote--India--Gurugram/C---Developer_R025462?shared_id=2a36b6e4-9c24-498e-9ccc-98f096f62753
2024/2023/2022 passouts eligible
Upto 12 LPA
Link : https://ciena.wd5.myworkdayjobs.com/en-US/Careers/job/Remote--India--Gurugram/C---Developer_R025462?shared_id=2a36b6e4-9c24-498e-9ccc-98f096f62753
๐3
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Indus Net Technologies is hiring Fresh MBA Graduates ๐๐๐โค๏ธโค๏ธโค๏ธ
Location- Kolkata
Date: 13th August, 2024.
Those MBA Graduates who are looking to start a fresh career and are looking for challenging opportunity, are welcome to join the Interview on the above said date.
Venue: Indus Net Technologies, Module 528, 4th Floor, SDF Building, Saltlake Sector V, Kolkata- 700091
Location- Kolkata
Date: 13th August, 2024.
Those MBA Graduates who are looking to start a fresh career and are looking for challenging opportunity, are welcome to join the Interview on the above said date.
Venue: Indus Net Technologies, Module 528, 4th Floor, SDF Building, Saltlake Sector V, Kolkata- 700091
๐2
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
pair<ll, ll> dfs(int curr, int prv, const vector<vector<ll>>& adj, const vector<ll>& connect_val, int k) {
ll tmp = connect_val[curr - 1];
pair<ll, ll> ans = {tmp, tmp};
for (auto x : adj[curr]) {
if (x == prv) continue;
auto tmp = dfs(x, curr, adj, connect_val, k);
ans.second += tmp.second;
ans.first += tmp.first;
}
ans.first = max(ans.first, -static_cast<ll>(k));
return ans;
}
ll getmaximumefficiency(int connect_nodes, const vector<int>& connect_from, const vector<int>& connect_to, const vector<int>& connect_val, int k) {
vector<vector<ll>> adj(connect_nodes + 1);
for (int i = 0; i < connect_from.size(); i++) {
ll u = connect_from[i], v = connect_to[i];
adj[u].push_back(v);
adj[v].push_back(u);
}
vector<ll> connect_val_ll(connect_val.begin(), connect_val.end());
return dfs(1, 0, adj, connect_val_ll, k).first;
}
Gamekraft โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
def lcs_length(a, b):
m, n = len(a), len(b)
dp = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if a[i - 1] == b[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
return dp[m][n]
def min_steps_to_transform(current, desired):
L = lcs_length(current, desired)
n = len(current)
min_steps = n - L
return min_steps
UBSโ
m, n = len(a), len(b)
dp = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if a[i - 1] == b[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
return dp[m][n]
def min_steps_to_transform(current, desired):
L = lcs_length(current, desired)
n = len(current)
min_steps = n - L
return min_steps
UBSโ