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 โ
#include <bits/stdc++.h>Maze Telepoters
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N + 1);
for (int i = 1; i <= N; i++) {
cin >> A[i];
}
vector<vector<int>> jump_count(N + 1, vector<int>(N + 1, 0));
vector<bool> visited(N + 1, false);
int total_distance = 0;
for (int start = 1; start <= N; ++start) {
if (visited[start]) continue;
vector<int> trace;
int current = start;
while (!visited[current]) {
visited[current] = true;
trace.push_back(current);
current = A[current];
}
int cycle_index = find(trace.begin(), trace.end(), current) - trace.begin();
int cycle_length = trace.size() - cycle_index;
for (int i = 0; i < trace.size(); ++i) {
for (int j = i; j < trace.size(); ++j) {
jump_count[trace[i]][trace[j]] = j - i;
if (i != j) {
jump_count[trace[j]][trace[i]] = trace.size() - (j - i);
}
}
}
}
for (int i = 1; i <= N; ++i) {
for (int j = 1; j <= N; ++j) {
total_distance += jump_count[i][j];
}
}
cout << total_distance << endl;
return 0;
}
#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<ll> count(ll k,vector<ll>& a) {
vector<ll> prime;
for (ll i=2;i<=sqrt(k);i++)
{
if (k%i==0)
{
prime.push_back(i);
while (k%i==0) k/=i;
}
}
if (k>1)prime.push_back(k);
vector<ll>counts(prime.size(),0);
for (auto num:a)
{
for (ll i=0;i<prime.size();i++)
{
ll factor=prime[i];
while (num%factor==0)
{
counts[i]++;
num/=factor;
}
}
}
return counts;
}
ll helper(vector<ll>a,ll k)
{
vector<ll>factorCounts=count(k,a);
return factorCounts.empty()?0:*min_element(factorCounts.begin(), factorCounts.end());
}
signed main() {
ll n, k; cin>>n>>k;
vector<ll>a(n);
for(ll i=0;i<n;i++) cin>>a[i];
cout<<min(n,helper(a,k));
return 0;
}
K-divisible number โ
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
int solve(int N, vector<int>& a, int K) {
unordered_map<int, int> freq;
for (int i = 0; i < N / 2; ++i) {
int diff = abs(a[i] - a[N - 1 - i]);
if (diff > K) {
diff = K;
}
freq[diff]++;
}
int max_freq = 0;
for (const auto& kvp : freq) {
max_freq = max(max_freq, kvp.second);
}
int moves = N / 2 - max_freq;
return moves;
}
Balanced Array โ
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
int solve(int N, vector<int>& a, int K) {
unordered_map<int, int> freq;
for (int i = 0; i < N / 2; ++i) {
int diff = abs(a[i] - a[N - 1 - i]);
if (diff > K) {
diff = K;
}
freq[diff]++;
}
int max_freq = 0;
for (const auto& kvp : freq) {
max_freq = max(max_freq, kvp.second);
}
int moves = N / 2 - max_freq;
return moves;
}
Balanced Array โ
โโโ#include <bits/stdc++.h>
#define ll long long
using namespace std;
bool isVowel(char c) {
return c == 'a'c == 'e' c == 'i' c == 'o' c == 'u' c == 'A' c == 'E' c == 'I' c == 'O' || c == 'U';
}
ll solve(vector<char>& a) {
ll n=a.size(),ans=0,cnt=0;
for (ll i=0;i<n;i++)
{
if (isVowel(a[i])) cnt++;
else ans+=(cnt*(cnt+1)/2),cnt=0;
}
if(cnt!=0) ans+=(cnt*(cnt+1)/2);
return ans;
}
signed main() {
ll n; cin>>n;
vector<char>a(n);
for(ll i=0;i<n;i++) cin>>a[i];
cout<<solve(a);
return 0;
}
โโโ
Flipkart โ
#define ll long long
using namespace std;
bool isVowel(char c) {
return c == 'a'
}
ll solve(vector<char>& a) {
ll n=a.size(),ans=0,cnt=0;
for (ll i=0;i<n;i++)
{
if (isVowel(a[i])) cnt++;
else ans+=(cnt*(cnt+1)/2),cnt=0;
}
if(cnt!=0) ans+=(cnt*(cnt+1)/2);
return ans;
}
signed main() {
ll n; cin>>n;
vector<char>a(n);
for(ll i=0;i<n;i++) cin>>a[i];
cout<<solve(a);
return 0;
}
โโโ
Flipkart โ