int Max (int N, int K, vector<int> arr) {
vector<int> b(N + 1, 0);
vector<int> c;
int cnt = 0;
for (int i = 1; i <= N; ++i) {
if (arr[i - 1] % 2 == 1) {
b[i] = 1;
} else {
b[i] = -1;
}
}
for (int i = 1; i <= N; ++i) {
b[i] += b[i - 1];
}
for (int i = 1; i < N; ++i) {
if (b[i] == 0) {
c.push_back(abs(arr[i] - arr[i - 1]));
}
}
sort(c.begin(), c.end());
int pt = 0, cost = 0;
while (pt < c.size() && cost + c[pt] <= K) {
cost += c[pt];
++pt;
}
return pt;
}
Max separation โ
def modular_exponentiation(base, exponent, mod):
result = 1
base = base % mod
while exponent > 0:
if exponent & 1:
result = (result * base) % mod
exponent = exponent >> 1
base = (base * base) % mod
return result
def solve(n):
MOD = 10**9 + 7
base = 3
result = modular_exponentiation(base, n, MOD)
return result
Attendance code โ
result = 1
base = base % mod
while exponent > 0:
if exponent & 1:
result = (result * base) % mod
exponent = exponent >> 1
base = (base * base) % mod
return result
def solve(n):
MOD = 10**9 + 7
base = 3
result = modular_exponentiation(base, n, MOD)
return result
Attendance code โ
๐คฉ1
int solve(int n, vector<vector<int>>& rels) {
vector<vector<int>> g(n);
vector<int> inD(n, 0);
for (auto& r : rels) {
g[r[0] - 1].push_back(r[1] - 1);
inD[r[1] - 1]++;
}
int k = 2;
int rnds = 0;
queue<int> q;
for (int i = 0; i < n; i++) {
if (inD[i] == 0) {
q.push(i);
}
}
while (!q.empty()) {
int sz = q.size();
rnds += (sz + k - 1) / k;
for (int i = 0; i < sz; i++) {
int m = q.front();
q.pop();
for (int nxt : g[m]) {
if (--inD[nxt] == 0) {
q.push(nxt);
}
}
}
}
return rnds;
}
Family Dinner โ
vector<vector<int>> g(n);
vector<int> inD(n, 0);
for (auto& r : rels) {
g[r[0] - 1].push_back(r[1] - 1);
inD[r[1] - 1]++;
}
int k = 2;
int rnds = 0;
queue<int> q;
for (int i = 0; i < n; i++) {
if (inD[i] == 0) {
q.push(i);
}
}
while (!q.empty()) {
int sz = q.size();
rnds += (sz + k - 1) / k;
for (int i = 0; i < sz; i++) {
int m = q.front();
q.pop();
for (int nxt : g[m]) {
if (--inD[nxt] == 0) {
q.push(nxt);
}
}
}
}
return rnds;
}
Family Dinner โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Propel
๐ Job Title: Software Developer
โ๐ป YOE: 2023 and 2024 grads
โก๏ธ Apply: https://talent.propelinc.com/jobs/Careers/26698000072645557/Fresher-Software-Developer?source=CareerSite
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
๐ Job Title: Software Developer
โ๐ป YOE: 2023 and 2024 grads
โก๏ธ Apply: https://talent.propelinc.com/jobs/Careers/26698000072645557/Fresher-Software-Developer?source=CareerSite
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Someone looking for Non-Tech Intern
https://www.linkedin.com/posts/alice-kujur-419459171_hiring-internship-businessdevelopment-activity-7199679996888555520-wx6l?utm_source=share&utm_medium=member_android
https://www.linkedin.com/posts/alice-kujur-419459171_hiring-internship-businessdevelopment-activity-7199679996888555520-wx6l?utm_source=share&utm_medium=member_android
Linkedin
#hiring #internship #businessdevelopment #pensionbox #bengalurujobs | Alice Kujur
๐ We're Hiring Business Development Interns! ๐
PensionBox is looking for passionate and driven individuals to join our team as Business Development Interns.
๐น Role: Business Development Intern
๐น Location: Bannerghatta Road, Bengaluru
๐น Stipend: 10Kโฆ
PensionBox is looking for passionate and driven individuals to join our team as Business Development Interns.
๐น Role: Business Development Intern
๐น Location: Bannerghatta Road, Bengaluru
๐น Stipend: 10Kโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Deloitte is hiring!
Position: Data Anlaytics - Internship
Qualification: Bachelorโs/ Masterโs/ MBA
Salary: 5.5 LPA (Expected)
Batch: 2022/ 2023/ 2024/ 2025
Experienc๏ปฟe: Freshers
Location: Delhi, Mumbai, India
๐Apply Now:
https://jobsindia.deloitte.com/job/Delhi-RA-A&IC-IA-Intern/24602144/
https://jobsindia.deloitte.com/job/Mumbai-RA-A&IC-Internal-Audit-intern-1/25345844/
Position: Data Anlaytics - Internship
Qualification: Bachelorโs/ Masterโs/ MBA
Salary: 5.5 LPA (Expected)
Batch: 2022/ 2023/ 2024/ 2025
Experienc๏ปฟe: Freshers
Location: Delhi, Mumbai, India
๐Apply Now:
https://jobsindia.deloitte.com/job/Delhi-RA-A&IC-IA-Intern/24602144/
https://jobsindia.deloitte.com/job/Mumbai-RA-A&IC-Internal-Audit-intern-1/25345844/
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include<bits/stdc++.h>
using namespace std;
bool solve(vector<vector<char>>& grid, int maxTime) {
int n = grid.size(), m = grid[0].size();
vector<vector<int>> dist(n, vector<int>(m, INT_MAX));
queue<pair<int, int>> q;
q.push({0, 0});
dist[0][0] = 0;
vector<int> dx = {-1, 0, 1, 0};
vector<int> dy = {0, 1, 0, -1};
while (!q.empty()) {
auto [x, y] = q.front();
q.pop();
for (int i = 0; i < 4; ++i) {
int nx = x + dx[i], ny = y + dy[i];
if (nx >= 0 && nx < n && ny >= 0 && ny < m && grid[nx][ny] == '.' && dist[nx][ny] > dist[x][y] + 1) {
dist[nx][ny] = dist[x][y] + 1;
q.push({nx, ny});
}
}
}
return dist[n - 1][m - 1] <= maxTime;
}
int main() {
int n, m, maxTime;
cin >> n >> m >> maxTime;
vector<vector<char>> grid(n, vector<char>(m));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
cin >> grid[i][j];
}
}
cout << (solve(grid, maxTime) ? "Yes" : "No") << endl;
return 0;
}
Reach the end in time โ
using namespace std;
bool solve(vector<vector<char>>& grid, int maxTime) {
int n = grid.size(), m = grid[0].size();
vector<vector<int>> dist(n, vector<int>(m, INT_MAX));
queue<pair<int, int>> q;
q.push({0, 0});
dist[0][0] = 0;
vector<int> dx = {-1, 0, 1, 0};
vector<int> dy = {0, 1, 0, -1};
while (!q.empty()) {
auto [x, y] = q.front();
q.pop();
for (int i = 0; i < 4; ++i) {
int nx = x + dx[i], ny = y + dy[i];
if (nx >= 0 && nx < n && ny >= 0 && ny < m && grid[nx][ny] == '.' && dist[nx][ny] > dist[x][y] + 1) {
dist[nx][ny] = dist[x][y] + 1;
q.push({nx, ny});
}
}
}
return dist[n - 1][m - 1] <= maxTime;
}
int main() {
int n, m, maxTime;
cin >> n >> m >> maxTime;
vector<vector<char>> grid(n, vector<char>(m));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
cin >> grid[i][j];
}
}
cout << (solve(grid, maxTime) ? "Yes" : "No") << endl;
return 0;
}
Reach the end in time โ
๐1
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int solve(int n, vector<int>& c, vector<int>& price) {
map<int, vector<int>> mp;
for (int i = 0; i < n; i++) {
mp[c[i]].push_back(price[i]);
}
for (auto& x : mp) {
sort(x.second.rbegin(), x.second.rend());
}
int sz = mp.size();
long long ans = 0;
vector<int> v;
for (auto& x : mp) {
v.push_back(x.second.back());
x.second.pop_back();
}
sort(v.begin(), v.end());
for (int i = 0; i < sz; i++) {
ans += (i + 1) * 1LL * v[i];
}
for (auto& x : mp) {
for (int num : x.second) {
ans += sz * num;
}
}
return ans;
}
Maximum Profit โ
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int solve(int n, vector<int>& c, vector<int>& price) {
map<int, vector<int>> mp;
for (int i = 0; i < n; i++) {
mp[c[i]].push_back(price[i]);
}
for (auto& x : mp) {
sort(x.second.rbegin(), x.second.rend());
}
int sz = mp.size();
long long ans = 0;
vector<int> v;
for (auto& x : mp) {
v.push_back(x.second.back());
x.second.pop_back();
}
sort(v.begin(), v.end());
for (int i = 0; i < sz; i++) {
ans += (i + 1) * 1LL * v[i];
}
for (auto& x : mp) {
for (int num : x.second) {
ans += sz * num;
}
}
return ans;
}
Maximum Profit โ
โค1
public static long findMissingInteger(ArrayList<Integer> arr, long k) {
Collections.sort(arr);
ArrayList<Integer> tmp = new ArrayList<>();
tmp.add(arr.get(0));
for (int i = 1; i < arr.size(); i++) {
if (arr.get(i) != tmp.get(tmp.size() - 1)) {
tmp.add(arr.get(i));
}
}
int l = 0, r = tmp.size(), m;
while (l < r) {
m = (l + r) / 2;
if (tmp.get(m) - 1 - m < k) {
l = m + 1;
} else {
r = m;
}
}
return l + k;
}
Missing Positive Integers โ
Collections.sort(arr);
ArrayList<Integer> tmp = new ArrayList<>();
tmp.add(arr.get(0));
for (int i = 1; i < arr.size(); i++) {
if (arr.get(i) != tmp.get(tmp.size() - 1)) {
tmp.add(arr.get(i));
}
}
int l = 0, r = tmp.size(), m;
while (l < r) {
m = (l + r) / 2;
if (tmp.get(m) - 1 - m < k) {
l = m + 1;
} else {
r = m;
}
}
return l + k;
}
Missing Positive Integers โ
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Exciting announcement from Flipkart! | Raunak Singh
Exciting announcement from Flipkart! ๐
Flipkart is introducing it's first ๐๐ป๐ณ๐ผ๐ฆ๐ฒ๐ฐ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ (ISCP)! ๐ This initiative aims to empower recent graduates and the wider cybersecurity community with a comprehensive 6-month InfoSec Certification programโฆ
Flipkart is introducing it's first ๐๐ป๐ณ๐ผ๐ฆ๐ฒ๐ฐ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ (ISCP)! ๐ This initiative aims to empower recent graduates and the wider cybersecurity community with a comprehensive 6-month InfoSec Certification programโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Quoppo is hiring for the role of Robotics Software Engineer
Batch : 2024, 2025, 2026
Apply Link -
https://www.linkedin.com/jobs/view/3938088395
Batch : 2024, 2025, 2026
Apply Link -
https://www.linkedin.com/jobs/view/3938088395
Linkedin
Quoppo hiring Robotics Software Engineer (Intern) in Pune, Maharashtra, India | LinkedIn
Posted 5:11:00 PM. Job for a portfolio company Meskolabs
About Meskolabs is a young, dynamic team dedicated toโฆSee this and similar jobs on LinkedIn.
About Meskolabs is a young, dynamic team dedicated toโฆSee this and similar jobs on LinkedIn.
def solution(matrix):
n = len(matrix)
v = [[0, matrix[i][0]] for i in range(n)]
for i in range(n):
v[i][1] = matrix[i][0]
row, col = i, 0
while row >= 0 and col < n:
v[i][0] += matrix[row][col]
row -= 1
col += 1
row = i + 1
col = n - 1
while row < n and col >= 0:
v[i][0] += matrix[row][col]
row += 1
col -= 1
v.sort()
return [v[i][1] for i in range(n)]
n = len(matrix)
v = [[0, matrix[i][0]] for i in range(n)]
for i in range(n):
v[i][1] = matrix[i][0]
row, col = i, 0
while row >= 0 and col < n:
v[i][0] += matrix[row][col]
row -= 1
col += 1
row = i + 1
col = n - 1
while row < n and col >= 0:
v[i][0] += matrix[row][col]
row += 1
col -= 1
v.sort()
return [v[i][1] for i in range(n)]
๐1
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
int main()
{
int t;
cin >> t;
while(t--)
{
int N;
string S;
cin >> N >> S;
vector<vector<long long>> dp(N + 1, vector<long long>(N + 1, 0));
dp[0][0] = 1;
for (int i = 0; i <= N; i++)
{
for (int j = 0; j <= i; j++)
{
if (S[i] == '(' || S[i] == '?')
{
dp[i + 1][j + 1] += dp[i][j];
dp[i + 1][j + 1] %= MOD;
}
if (S[i] == ')' || S[i] == '?')
{
if (j > 0)
{
dp[i + 1][j - 1] += dp[i][j];
dp[i + 1][j - 1] %= MOD;
}
}
}
}
cout << dp[N][0] << endl;
}
}
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
CyberArk is hiring for Associate Software Engineer
Expected Salary: 6-12 LPA
Apply here:
https://jobs.smartrecruiters.com/Cyberark1/743999991207385-associate-software-engineer
Expected Salary: 6-12 LPA
Apply here:
https://jobs.smartrecruiters.com/Cyberark1/743999991207385-associate-software-engineer
Cyberark
Cyberark is looking for a Associate Software Engineer in Hyderabad, India
Attend all training programs and completing all tasks set by the supervisor and assisting other trainees wherever possible.Ability to design and code the right solutions starting with broadly defi...
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Engagedly is hiring for DevOps Engineer (0-1 years)
Expected Salary: 6-12 LPA
Apply here:
https://engagedly.freshteam.com/jobs/ClkOybVRjER4/devops-engineer
Expected Salary: 6-12 LPA
Apply here:
https://engagedly.freshteam.com/jobs/ClkOybVRjER4/devops-engineer
Freshteam
Hiring for DevOps Engineer for Bengaluru - Entry level
Posted by : Engagedly | AWS,DOCKER,CI/CD
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Ksolves hiring Freshers ( with 6 months of traning in SAP-ABAP) .
Must be good in communication and Programming
Location :- Indore or Noida
Pls. Share your resume at Mohit.Kumar@Ksolves.com
Must be good in communication and Programming
Location :- Indore or Noida
Pls. Share your resume at Mohit.Kumar@Ksolves.com
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
India Blockchain Summit 2024 is looking for Backend Developer Intern - Remote
Apply here:
https://linkedin.com/jobs/view/3938450647/
Apply here:
https://linkedin.com/jobs/view/3938450647/
Linkedin
India Blockchain Summit 2024 hiring Backend Developer Intern in India | LinkedIn
Posted 10:40:39 AM. Title: Backend Developer Intern at India Blockchain SummitLocation: RemoteJob Type: InternshipAboutโฆSee this and similar jobs on LinkedIn.