Who have Infosys SP and DSP roll exam ??
And what's your exam time??
https://bit.ly/codewithanusha
https://bit.ly/infosys-SP-DSP
And what's your exam time??
https://bit.ly/codewithanusha
https://bit.ly/infosys-SP-DSP
π1
// Infosys
//Given Array A having N integers and divisor K
int morethanNbyK(vector<int> arr, int n, int k)
{
int x = n / k;
int ans = 0;
unordered_map<int, int> freq;
for (auto i : arr)
freq[i]++;
for (auto i : freq)
{
if (i.second > x)
{
ans += i.first;
}
}
return ans;
}
// @codewithvirus
// @codewithvirus
// @codewithvirus
// @codewithvirus
https://bit.ly/infosys-SP-DSP
//Given Array A having N integers and divisor K
int morethanNbyK(vector<int> arr, int n, int k)
{
int x = n / k;
int ans = 0;
unordered_map<int, int> freq;
for (auto i : arr)
freq[i]++;
for (auto i : freq)
{
if (i.second > x)
{
ans += i.first;
}
}
return ans;
}
// @codewithvirus
// @codewithvirus
// @codewithvirus
// @codewithvirus
https://bit.ly/infosys-SP-DSP
// Infosys
// N flowers on a Recatangular pana
int ans = 100000000;
void solve(vector<int> a, int n, int k, int index, int sum,
int maxsum)
{
if (k == 1)
{
maxsum = max(maxsum, sum);
sum = 0;
for (int i = index; i < n; i++)
{
sum += a[i];
}
maxsum = max(maxsum, sum);
ans = min(ans, maxsum);
return;
}
sum = 0;
for (int i = index; i < n; i++)
{
sum += a[i];
maxsum = max(maxsum, sum);
solve(a, n, k - 1, i + 1, sum, maxsum);
}
}
int GetMaxBeauty(int N, int K, vector<int> A)
{
solve(A, N, K, 0, 0, 0);
return ans;
}
// @codewithvirus
// @codewithvirus
// @codewithvirus
// @codewithvirus
https://bit.ly/infosys-SP-DSP
// N flowers on a Recatangular pana
int ans = 100000000;
void solve(vector<int> a, int n, int k, int index, int sum,
int maxsum)
{
if (k == 1)
{
maxsum = max(maxsum, sum);
sum = 0;
for (int i = index; i < n; i++)
{
sum += a[i];
}
maxsum = max(maxsum, sum);
ans = min(ans, maxsum);
return;
}
sum = 0;
for (int i = index; i < n; i++)
{
sum += a[i];
maxsum = max(maxsum, sum);
solve(a, n, k - 1, i + 1, sum, maxsum);
}
}
int GetMaxBeauty(int N, int K, vector<int> A)
{
solve(A, N, K, 0, 0, 0);
return ans;
}
// @codewithvirus
// @codewithvirus
// @codewithvirus
// @codewithvirus
https://bit.ly/infosys-SP-DSP
π3
Infosys
C++ language
@codewithvirus
You are given a string S of length N. You can erase any substring of S of size <N. You need to return the lexicographically smallest remaining string after erasing a substring of S.
https://bit.ly/infosys-SP-DSP
C++ language
@codewithvirus
You are given a string S of length N. You can erase any substring of S of size <N. You need to return the lexicographically smallest remaining string after erasing a substring of S.
https://bit.ly/infosys-SP-DSP
π2
You are given a pair of string A and B of length N
Infosys
@codewithvirus
https://bit.ly/infosys-SP-DSP
Infosys
@codewithvirus
https://bit.ly/infosys-SP-DSP
π2