#include <vector>
#include <iostream>
using namespace std;
int solve(vector<vector<int>>& operations) {
const int MAX_N = 100001;
vector<int> diff(MAX_N + 1, 0);
for (const auto& op : operations) {
int l = op[0];
int r = op[1];
diff[l] += 1;
if (r + 1 <= MAX_N) {
diff[r + 1] -= 1;
}
}
int sum = 0;
int aa = 0;
for (int i = 1; i <= MAX_N; ++i) {
aa += diff[i];
if (aa % 2 != 0) {
sum += i;
}
}
return sum;
}
Flipping Switches โ
๐1
MOD = 10**9 + 7
def factorial(n, mod):
result = 1
for i in range(2, n + 1):
result = (result * i) % mod
return result
def mod_inv(a, p):
return pow(a, p - 2, p)
def comb(n, k, mod):
if k > n:
return 0
numerator = factorial(n, mod)
denominator = (factorial(k, mod) * factorial(n - k, mod)) % mod
return (numerator * mod_inv(denominator, mod)) % mod
def count_ways(N, C, V):
if V > C:
return 0
total_ways = 0
for i in range(V, C + 1):
total_ways = (total_ways + comb(C, i, MOD)) % MOD
return total_ways
N, C, V = map(int, input().split())
print(count_ways(N, C, V))
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Hello Connections,
We are hiring for our Client
Position: Analyst - Decision Science
Experience: 0-6month
Location : Bangalore- WFO
Skills: SQL, Python ,R and Tableau
A bachelorโs degree in Statistics or other quantitative disciplines such as Engineering, Applied Mathematics, etc from IIT and NIT.
Interested candidate can share their resume at aiman.bano@zyoin.com
Candidates from Bangalore location is preferred.
We are hiring for our Client
Position: Analyst - Decision Science
Experience: 0-6month
Location : Bangalore- WFO
Skills: SQL, Python ,R and Tableau
A bachelorโs degree in Statistics or other quantitative disciplines such as Engineering, Applied Mathematics, etc from IIT and NIT.
Interested candidate can share their resume at aiman.bano@zyoin.com
Candidates from Bangalore location is preferred.
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>.
#include <unordered_map>
#include <string>
string solve(const std::string &s) {
unordered_map<char, char> charValueMap = {
{'a', '0'}, {'b', '0'}, {'c', '0'}, {'d', '0'}, {'e', '0'},
{'f', '1'}, {'g', '1'}, {'h', '1'}, {'i', '1'}, {'j', '1'},
{'k', '0'}, {'l', '0'}, {'m', '0'}, {'n', '0'}, {'o', '0'},
{'p', '1'}, {'q', '1'}, {'r', '1'}, {'s', '1'}, {'t', '1'},
{'u', '0'}, {'v', '0'}, {'w', '0'}, {'x', '0'}, {'y', '0'},
{'z', '1'}
};
std::string binaryString;
for (char ch : s) {
binaryString += charValueMap[ch];
}
return binaryString;
}
int main() {
string inputString;
getline(std::cin, inputString);
string result = solve(inputString);
cout << result << std::endl;
return 0;
}
TEXAS 2
๐1๐ฅ1
def findParent(processNumber):
if processNumber == 1:
return None
left, right = 1, processNumber
while left < right:
mid = (left + right) // 2
children_up_to_mid = mid * (mid + 1) // 2
if children_up_to_mid < processNumber:
left = mid + 1
else:
right = mid
parent = left
children_up_to_parent = parent * (parent + 1) // 2
return parent if children_up_to_parent >= processNumber else parent - 1
Process Tree โ
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
vector<int> tree[MAXN];
vector<int> prefixSum;
vector<int> cost;
vector<int> parent;
int N, K;
void dfs(int node, int par, int currentSum) {
prefixSum[node] = currentSum + cost[node];
parent[node] = par;
for (int child : tree[node]) {
if (child != par) {
dfs(child, node, prefixSum[node]);
}
}
}
int solve(int N, int K, vector<int>& A, vector<vector<int>>& edges) {
cost = A;
prefixSum.assign(N, 0);
parent.assign(N, -1);
for (int i = 0; i < N; ++i) {
tree[i].clear();
}
for (auto& edge : edges) {
int u = edge[0] - 1;
int v = edge[1] - 1;
tree[u].push_back(v);
tree[v].push_back(u);
}
dfs(0, -1, 0);
int maxCandies = 0;
for (int i = 0; i < N; ++i) {
int remainingMoney = K;
int candies = 0;
for (int j = i; j != -1; j = parent[j]) {
if (remainingMoney >= cost[j]) {
remainingMoney -= cost[j];
candies++;
} else {
break;
}
}
maxCandies = max(maxCandies, candies);
}
return maxCandies;
}
Zepto โ
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
using namespace std;
int solve(int N, int K, const vector<int>& houses) {
unordered_map<int, int> houseIndex;
for (int i = 0; i < houses.size(); ++i) {
houseIndex[houses[i] - 1] = i + 1;
}
priority_queue<int> pq;
for (int i = 0; i < K; ++i) {
pq.push(houseIndex[i]);
}
int ans = pq.top();
for (int i = 1; i + K - 1 < N; ++i) {
pq.push(houseIndex[i + K - 1]);
while (!pq.empty() && pq.top() > houseIndex[i + K - 1]) {
pq.pop();
}
ans = min(ans, pq.top());
}
return ans;
}
Happy neighborhoodโ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define sz(c) c.size()
ll solve()
{
ll n, m, i, j;
ll k;
ll l, r;
string s;
cin >> s;
n = sz(s);
ll dp[n][5];
memset(dp, 0, sizeof(dp));
if (s[0] == 'a')
dp[0][0] = 1;
for (int i = 1; i < n; i++)
{
if (s[i] == 'a')
{
dp[i][0] = 1 + dp[i - 1][0];
}
else
dp[i][0] = dp[i - 1][0];
if (s[i] == 'e')
{
if (dp[i - 1][1] != 0)
dp[i][1] = 1 + dp[i - 1][1];
if (dp[i - 1][0] != 0)
dp[i][1] = max(dp[i][1], 1 + dp[i - 1][0]);
}
else
dp[i][1] = dp[i - 1][1];
if (s[i] == 'i')
{
if (dp[i - 1][2] != 0)
dp[i][2] = 1 + dp[i - 1][2];
if (dp[i - 1][1] != 0)
dp[i][2] = max(dp[i][2], 1 + dp[i - 1][1]);
}
else
dp[i][2] = dp[i - 1][2];
if (s[i] == 'o')
{
if (dp[i - 1][3] != 0)
dp[i][3] = 1 + dp[i - 1][3];
if (dp[i - 1][2] != 0)
dp[i][3] = max(dp[i][3], 1 + dp[i - 1][2]);
}
else
dp[i][3] = dp[i - 1][3];
if (s[i] == 'u')
{
if (dp[i - 1][4] != 0)
dp[i][4] = 1 + dp[i - 1][4];
if (dp[i - 1][3] != 0)
dp[i][4] = max(dp[i][4], 1 + dp[i - 1][3]);
}
else
dp[i][4] = dp[i - 1][4];
}
cout << dp[n - 1][4];
return 0;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
t = 1;
// cin>>t;
while (t--)
{
solve();
}
return 0;
}
//longest Vowel subsequence with ordered vowel โ
using namespace std;
#define endl '\n'
#define ll long long
#define sz(c) c.size()
ll solve()
{
ll n, m, i, j;
ll k;
ll l, r;
string s;
cin >> s;
n = sz(s);
ll dp[n][5];
memset(dp, 0, sizeof(dp));
if (s[0] == 'a')
dp[0][0] = 1;
for (int i = 1; i < n; i++)
{
if (s[i] == 'a')
{
dp[i][0] = 1 + dp[i - 1][0];
}
else
dp[i][0] = dp[i - 1][0];
if (s[i] == 'e')
{
if (dp[i - 1][1] != 0)
dp[i][1] = 1 + dp[i - 1][1];
if (dp[i - 1][0] != 0)
dp[i][1] = max(dp[i][1], 1 + dp[i - 1][0]);
}
else
dp[i][1] = dp[i - 1][1];
if (s[i] == 'i')
{
if (dp[i - 1][2] != 0)
dp[i][2] = 1 + dp[i - 1][2];
if (dp[i - 1][1] != 0)
dp[i][2] = max(dp[i][2], 1 + dp[i - 1][1]);
}
else
dp[i][2] = dp[i - 1][2];
if (s[i] == 'o')
{
if (dp[i - 1][3] != 0)
dp[i][3] = 1 + dp[i - 1][3];
if (dp[i - 1][2] != 0)
dp[i][3] = max(dp[i][3], 1 + dp[i - 1][2]);
}
else
dp[i][3] = dp[i - 1][3];
if (s[i] == 'u')
{
if (dp[i - 1][4] != 0)
dp[i][4] = 1 + dp[i - 1][4];
if (dp[i - 1][3] != 0)
dp[i][4] = max(dp[i][4], 1 + dp[i - 1][3]);
}
else
dp[i][4] = dp[i - 1][4];
}
cout << dp[n - 1][4];
return 0;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
t = 1;
// cin>>t;
while (t--)
{
solve();
}
return 0;
}
//longest Vowel subsequence with ordered vowel โ
๐1
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
vector<int> smallestLexicographicalSubsequence(vector<int>& hubs, int k) {
vector<int> result;
stack<int> st;
int n = hubs.size();
for (int i = 0; i < n; ++i) {
while (!st.empty() && st.top() > hubs[i] && st.size() + (n - i) > k) {
st.pop();
}
if (st.size() < k) {
st.push(hubs[i]);
}
}
while (!st.empty()) {
result.insert(result.begin(), st.top());
st.pop();
}
return result;
}
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Internship Opportunity
6 months Data Analyst Internship at Emittr
Batch : 2024 passouts
Link : send your resume and details at afreen.naz@emitrr.com
6 months Data Analyst Internship at Emittr
Batch : 2024 passouts
Link : send your resume and details at afreen.naz@emitrr.com
๐1
GlobalNodes Hiring Freshers !!
Role - Data Scientist - Freshers (0-1 year experience)
Location: [Gurugram]
Looking for passionate and motivated freshers to join the team as Data Scientists. The ideal candidates should have a strong foundation in data analysis, statistical methods, and machine learning. Familiarity with Python, R, and data visualization tools is a plus. This is a great opportunity to kick-start your career in data science with hands-on experience and mentorship.
Please email your resume at avijit.swain@globalnodes.ai
Role - Data Scientist - Freshers (0-1 year experience)
Location: [Gurugram]
Looking for passionate and motivated freshers to join the team as Data Scientists. The ideal candidates should have a strong foundation in data analysis, statistical methods, and machine learning. Familiarity with Python, R, and data visualization tools is a plus. This is a great opportunity to kick-start your career in data science with hands-on experience and mentorship.
Please email your resume at avijit.swain@globalnodes.ai
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name : Broadabridge
Role : Associate Technical Account Manager
Batch : 2024 passouts
Location : Mumbai
Link. : https://broadridge.wd5.myworkdayjobs.com/Careers/job/Mumbai---Supreme-Business-Park/Associate-Technical-Account-Manager_JR1065417
Role : Associate Technical Account Manager
Batch : 2024 passouts
Location : Mumbai
Link. : https://broadridge.wd5.myworkdayjobs.com/Careers/job/Mumbai---Supreme-Business-Park/Associate-Technical-Account-Manager_JR1065417
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Multiple Openings Available | 2023, 2024 Passouts
Trainee Software Engineer
Noida
10 openings
Send resume to HR :
Monali@omniesolutions.com
Trainee Software Engineer
Noida
10 openings
Send resume to HR :
Monali@omniesolutions.com
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company name: BluSmart
Role: Android Developer Intern
Batch Eligible: 2025 & 2026 passouts
Apply link :
https://www.linkedin.com/jobs/view/3988523412?original_referer=https%3A%2F%2Fperfleap.in%2F
Role: Android Developer Intern
Batch Eligible: 2025 & 2026 passouts
Apply link :
https://www.linkedin.com/jobs/view/3988523412?original_referer=https%3A%2F%2Fperfleap.in%2F