def largestArea(samples):
R = len(samples)
C = len(samples[0])
S = [[0] * C for _ in range(R)]
M = [[0] * C for _ in range(R)]
for d in range(R):
for b in range(C):
M[d][b] = samples[d][b]
for i in range(R):
S[i][0] = M[i][0]
for j in range(C):
S[0][j] = M[0][j]
for i in range(1, R):
for j in range(1, C):
if M[i][j] == 1:
S[i][j] = min(S[i][j-1], min(S[i-1][j], S[i-1][j-1])) + 1
else:
S[i][j] = 0
max_of_s = S[0][0]
max_i = 0
max_j = 0
for i in range(R):
for j in range(C):
if max_of_s < S[i][j]:
max_of_s = S[i][j]
max_i = i
max_j = j
return abs(max_i - max_of_s) - max_i
Product Defects โ
R = len(samples)
C = len(samples[0])
S = [[0] * C for _ in range(R)]
M = [[0] * C for _ in range(R)]
for d in range(R):
for b in range(C):
M[d][b] = samples[d][b]
for i in range(R):
S[i][0] = M[i][0]
for j in range(C):
S[0][j] = M[0][j]
for i in range(1, R):
for j in range(1, C):
if M[i][j] == 1:
S[i][j] = min(S[i][j-1], min(S[i-1][j], S[i-1][j-1])) + 1
else:
S[i][j] = 0
max_of_s = S[0][0]
max_i = 0
max_j = 0
for i in range(R):
for j in range(C):
if max_of_s < S[i][j]:
max_of_s = S[i][j]
max_i = i
max_j = j
return abs(max_i - max_of_s) - max_i
Product Defects โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company โ DueToHQ
Role โ Business Analytics Internship
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/details/work-from-home-business-analytics-internship-at-duetohq1713164431?utm_source=cp_link&referral=web_share
Company โ PapaSiddhi
Role โ Machine Learning Development
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/details/machine-learning-development-internship-in-udaipur-at-papasiddhi1713153810?utm_source=cp_link&referral=web_share
Company โ Ozibook Tech Solutions Private Limited
Role โ Data Analytics Internship
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/details/work-from-home-part-time-data-analytics-internship-at-ozibook-tech-solutions-private-limited1713066596?utm_source=cp_link&referral=web_share
Role โ Business Analytics Internship
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/details/work-from-home-business-analytics-internship-at-duetohq1713164431?utm_source=cp_link&referral=web_share
Company โ PapaSiddhi
Role โ Machine Learning Development
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/details/machine-learning-development-internship-in-udaipur-at-papasiddhi1713153810?utm_source=cp_link&referral=web_share
Company โ Ozibook Tech Solutions Private Limited
Role โ Data Analytics Internship
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/details/work-from-home-part-time-data-analytics-internship-at-ozibook-tech-solutions-private-limited1713066596?utm_source=cp_link&referral=web_share
Internshala
Business Analytics Work From Home Internship at DueToHQ
Selected intern's day-to-day responsibilities include:
Assist in collecting, organizing, and analyzing data from various sources to identify trends, patterns, and opportunities.
Work closely with cross-functional teams to understand business requirementsโฆ
Assist in collecting, organizing, and analyzing data from various sources to identify trends, patterns, and opportunities.
Work closely with cross-functional teams to understand business requirementsโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐interactly.video is hiring for the role of Frontend Intern (ReactJs)
Batch: 2024, 2025
Stipend: 25K-30K per month
๐Apply here: https://wellfound.com/l/2zfith
๐1010Analytics is hiring for the role of SDE Intern (Rust Developer)
Stipend: 25K-30K per month
๐Apply here: https://wellfound.com/l/2A97P5
๐Elchemy is hiring for the role of SDE Intern
Batch: 2024, 2025
Stipend: 15-20K
๐Apply here: https://wellfound.com/l/2A8ZUB
Batch: 2024, 2025
Stipend: 25K-30K per month
๐Apply here: https://wellfound.com/l/2zfith
๐1010Analytics is hiring for the role of SDE Intern (Rust Developer)
Stipend: 25K-30K per month
๐Apply here: https://wellfound.com/l/2A97P5
๐Elchemy is hiring for the role of SDE Intern
Batch: 2024, 2025
Stipend: 15-20K
๐Apply here: https://wellfound.com/l/2A8ZUB
Wellfound (formerly AngelList Talent)
ReactJs Front End Developer Intern at interactly.video โข Hyderabad
interactly.video is hiring a ReactJs Front End Developer Intern in Hyderabad - Apply now on Wellfound (formerly AngelList Talent)! **Job Description**
We are looking for a JavaScript developer who has...
We are looking for a JavaScript developer who has...
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Maruti Suzuki All India Hiring Test:
Role: Assistant Manager
Graduation Year: 2022
Degree: B.Tech / M.Tech
Eligible Branches: Mechanical, Automobile, Civil, Electrical, Electronics, Mechatronics and Tool & Die
Age: 21 to 27 years
Work Experience: 12 to 22 months
Selection Process:
1. Profile Shortlisting
2. Online Test (Technical, Aptitude & Psychometric)
3. Personal Interview (Technical + HR)
4. Offer
5. Medical Test
6. Joining
B.Tech CTC: 10.34 LPA (8.3 LPA - Fixed)
M.Tech CTC: 10.99 LPA (8.85 LPA Fixed)
Location: PAN - India
Apply Link: https://maruti.app.param.ai/jobs/all-india-hiring-ait-2024-btech-and-mtech
Last Date to Apply: 21st April 2024
Role: Assistant Manager
Graduation Year: 2022
Degree: B.Tech / M.Tech
Eligible Branches: Mechanical, Automobile, Civil, Electrical, Electronics, Mechatronics and Tool & Die
Age: 21 to 27 years
Work Experience: 12 to 22 months
Selection Process:
1. Profile Shortlisting
2. Online Test (Technical, Aptitude & Psychometric)
3. Personal Interview (Technical + HR)
4. Offer
5. Medical Test
6. Joining
B.Tech CTC: 10.34 LPA (8.3 LPA - Fixed)
M.Tech CTC: 10.99 LPA (8.85 LPA Fixed)
Location: PAN - India
Apply Link: https://maruti.app.param.ai/jobs/all-india-hiring-ait-2024-btech-and-mtech
Last Date to Apply: 21st April 2024
๐2
private static double[] calculateMovingAverage(int[] array, int K) {
double[] smoothedArray = new double[array.length - K + 1];
double sum = 0;
for (int i = 0; i < K; i++) {
sum += array[i];
}
for (int i = 0; i <= array.length - K; i++) {
if (i > 0) {
sum = sum - array[i - 1] + array[i + K - 1];
}
smoothedArray[i] = sum / K;
}
return smoothedArray;
}
Moving Averagesโ
double[] smoothedArray = new double[array.length - K + 1];
double sum = 0;
for (int i = 0; i < K; i++) {
sum += array[i];
}
for (int i = 0; i <= array.length - K; i++) {
if (i > 0) {
sum = sum - array[i - 1] + array[i + K - 1];
}
smoothedArray[i] = sum / K;
}
return smoothedArray;
}
Moving Averagesโ
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Global Payments
๐ Job Title: Associate Software Engineer
โ๐ป YOE: 0-1 years
โก๏ธ Apply: https://jobs.globalpayments.com/en/jobs/r0048707/associate-software-engineer/
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
๐ Job Title: Associate Software Engineer
โ๐ป YOE: 0-1 years
โก๏ธ Apply: https://jobs.globalpayments.com/en/jobs/r0048707/associate-software-engineer/
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
โค1
#include <iostream>
#include <vector>
using namespace std;
int divideTerritory(int n, vector<int>& qualities) {
int totalQuality = 0;
for (int i = 0; i < n; ++i) {
totalQuality += qualities[i];
}
if (totalQuality % 3 != 0) {
return 0;
}
int targetQuality = totalQuality / 3;
vector<int> prefixSums(n, 0);
int currentSum = 0;
int count = 0;
for (int i = 0; i < n; ++i) {
currentSum += qualities[i];
prefixSums[i] = currentSum;
}
for (int i = 0; i < n - 2; ++i) {
if (prefixSums[i] == targetQuality) {
for (int j = i + 1; j < n - 1; ++j) {
if (prefixSums[j] - prefixSums[i] == targetQuality && prefixSums.back() - prefixSums[j] == targetQuality) {
count++;
}
}
}
}
return count;
}
Three little pigs โ
#include <vector>
using namespace std;
int divideTerritory(int n, vector<int>& qualities) {
int totalQuality = 0;
for (int i = 0; i < n; ++i) {
totalQuality += qualities[i];
}
if (totalQuality % 3 != 0) {
return 0;
}
int targetQuality = totalQuality / 3;
vector<int> prefixSums(n, 0);
int currentSum = 0;
int count = 0;
for (int i = 0; i < n; ++i) {
currentSum += qualities[i];
prefixSums[i] = currentSum;
}
for (int i = 0; i < n - 2; ++i) {
if (prefixSums[i] == targetQuality) {
for (int j = i + 1; j < n - 1; ++j) {
if (prefixSums[j] - prefixSums[i] == targetQuality && prefixSums.back() - prefixSums[j] == targetQuality) {
count++;
}
}
}
}
return count;
}
Three little pigs โ
#include <iostream>
#include <string>
#include <stack>
using namespace std;
int solve(const string& s) {
stack<char> stk;
int insertions = 0;
for (char c : s) {
if (c == '(') {
stk.push(c);
} else {
if (stk.empty()) {
insertions++;
} else {
stk.pop();
}
}
}
insertions += stk.size();
return insertions;
}
The String โ
#include <string>
#include <stack>
using namespace std;
int solve(const string& s) {
stack<char> stk;
int insertions = 0;
for (char c : s) {
if (c == '(') {
stk.push(c);
} else {
if (stk.empty()) {
insertions++;
} else {
stk.pop();
}
}
}
insertions += stk.size();
return insertions;
}
The String โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
#include <iostream> #include <vector> using namespace std; int divideTerritory(int n, vector<int>& qualities) { int totalQuality = 0; for (int i = 0; i < n; ++i) { totalQuality += qualities[i]; } if (totalQuality % 3 != 0) { โฆ
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[110][110];
ll currsumdp[110][110];
ll sum=0;
ll helper(ll i,ll n,ll part,ll curr,ll totsum,vector<ll>&a)
{
if(i!=n and part==4) return 0;
if(i==n) return(part==4)?1:0;
if(currsumdp[i][part]) return dp[i][part];
curr+=a[i];
currsumdp[i][part]=1;
return dp[i][part]=helper(i+1,n,part,curr,totsum,a)+((curr==(totsum/3)*part)?helper(i+1,n,part+1,curr,totsum,a):0);
}
ll solve(vector<ll>&a)
{
ll n=a.size();
for(auto it:a) sum+=it;
if(n<3 or sum%3) return 0;
memset(dp,-1,sizeof(dp));
return helper(0,n,1,0,sum,a);
}
signed main() {
ll n; cin>>n;
vector<ll>a(n);
for(ll i=0;i<n;i++) cin>>a[i];
cout<<solve(a);
return 0;
}
Three little pigs โ
๐3๐2
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll solve(vector<char>&a)
{
stack<char>st;
ll n=a.size();
ll i=0;
while(i<n)
{
if(a[i]=='P')
{
i++;
st.push(a[i]);
}
else if(a[i]=='B')
{
i++;
if(st.top()==a[i]) st.pop();
else break;
}
i++;
}
if(st.empty()) return -1;
return st.size()+1;
}
signed main() {
string s;
getline(cin,s);
vector<char>a;
for(auto it:s)
if(it!=' ') a.push_back(it);
cout<<solve(a);
return 0;
}
Flipkart โ
int countSetBits(int num) {
return __builtin_popcount(num);
}
int main() {
int T;
cin >> T;
while (T--) {
int N, K;
cin >> N >> K;
vector<int> array(N);
for (int i = 0; i < N; i++) {
cin >> array[i];
}
int validSubsetCount = 0;
int maxSubsetMask = (1 << N) - 1;
for (int mask = 0; mask <= maxSubsetMask; mask++) {
int subsetSum = 0;
for (int j = 0; j < N; j++) {
if (mask & (1 << j)) {
subsetSum += array[j];
}
}
if (countSetBits(subsetSum) == K) {
validSubsetCount++;
}
}
cout << validSubsetCount << endl;
}
return 0;
}
Flipkart โ
return __builtin_popcount(num);
}
int main() {
int T;
cin >> T;
while (T--) {
int N, K;
cin >> N >> K;
vector<int> array(N);
for (int i = 0; i < N; i++) {
cin >> array[i];
}
int validSubsetCount = 0;
int maxSubsetMask = (1 << N) - 1;
for (int mask = 0; mask <= maxSubsetMask; mask++) {
int subsetSum = 0;
for (int j = 0; j < N; j++) {
if (mask & (1 << j)) {
subsetSum += array[j];
}
}
if (countSetBits(subsetSum) == K) {
validSubsetCount++;
}
}
cout << validSubsetCount << endl;
}
return 0;
}
Flipkart โ
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int maxBagsFilled(int weight, int s1, int s2, int s3) {
vector<int> dp(weight + 1, -1e9);
dp[0] = 0;
vector<int> sizes = {s1, s2, s3};
for (int i = 1; i <= weight; i++) {
for (int size : sizes) {
if (i >= size && dp[i - size] != -1e9) {
dp[i] = max(dp[i], dp[i - size] + 1);
}
}
}
return dp[weight] > 0 ? dp[weight] : 0;
}
int main() {
int weight;
int s1, s2, s3;
cin >> weight;
cin >> s1 >> s2 >> s3;
cout << maxBagsFilled(weight, s1, s2, s3) << endl;
return 0;
}
Flipkart โ
#include <vector>
#include <algorithm>
using namespace std;
int maxBagsFilled(int weight, int s1, int s2, int s3) {
vector<int> dp(weight + 1, -1e9);
dp[0] = 0;
vector<int> sizes = {s1, s2, s3};
for (int i = 1; i <= weight; i++) {
for (int size : sizes) {
if (i >= size && dp[i - size] != -1e9) {
dp[i] = max(dp[i], dp[i - size] + 1);
}
}
}
return dp[weight] > 0 ? dp[weight] : 0;
}
int main() {
int weight;
int s1, s2, s3;
cin >> weight;
cin >> s1 >> s2 >> s3;
cout << maxBagsFilled(weight, s1, s2, s3) << endl;
return 0;
}
Flipkart โ