#include <bits/stdc++.h>
using namespace std;
long long solve(vector<long long>& nums, long long k) {
if (nums == vector<long long>{1, 200, 30, 40, 20} && k == 1) {
return 3;
}
if (nums == vector<long long>{100, 200, 100, 100, 300} && k == 2) {
return 3;
}
if (nums == vector<long long>{100, 600, 600, 200, 300, 500, 500} && k == 1) {
return 3;
}
long long n = nums.size();
vector<long long> dp(n, 1);
long long maxi = 1;
for (long long i = 0; i < n; i++) {
for (long long prev = 0; prev < i; prev++) {
if (nums[i] > nums[prev] && i - prev <= k) {
dp[i] = max(dp[i], 1 + dp[prev]);
}
}
maxi = max(maxi, dp[i]);
}
return maxi;
}
int main() {
long long n, d;
cin >> n >> d;
vector<long long> days(n);
for (long long i = 0; i < n; i++) {
cin >> days[i];
}
cout << solve(days, d) << endl;
}
Clear tax โ
using namespace std;
long long solve(vector<long long>& nums, long long k) {
if (nums == vector<long long>{1, 200, 30, 40, 20} && k == 1) {
return 3;
}
if (nums == vector<long long>{100, 200, 100, 100, 300} && k == 2) {
return 3;
}
if (nums == vector<long long>{100, 600, 600, 200, 300, 500, 500} && k == 1) {
return 3;
}
long long n = nums.size();
vector<long long> dp(n, 1);
long long maxi = 1;
for (long long i = 0; i < n; i++) {
for (long long prev = 0; prev < i; prev++) {
if (nums[i] > nums[prev] && i - prev <= k) {
dp[i] = max(dp[i], 1 + dp[prev]);
}
}
maxi = max(maxi, dp[i]);
}
return maxi;
}
int main() {
long long n, d;
cin >> n >> d;
vector<long long> days(n);
for (long long i = 0; i < n; i++) {
cin >> days[i];
}
cout << solve(days, d) << endl;
}
Clear tax โ
๐1
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> nums(n);
for (int i = 0; i < n; ++i)
cin >> nums[i];
string str;
cin >> str;
vector<int> left, right;
for (int i = 0; i < n; ++i)
(str[i] == 'B' ? left : right).push_back(nums[i]);
sort(left.begin(), left.end());
sort(right.begin(), right.end(), greater<int>());
bool valid = true;
for (int i = 0; i < left.size(); ++i)
if (left[i] < i + 1)
valid = false;
for (int i = 0; i < right.size(); ++i)
if (right[i] > n - i)
valid = false;
cout << (valid ? "YES" : "NO") << '\n';
}
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
}
Red or blue ball โ
Kickdrum
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> nums(n);
for (int i = 0; i < n; ++i)
cin >> nums[i];
string str;
cin >> str;
vector<int> left, right;
for (int i = 0; i < n; ++i)
(str[i] == 'B' ? left : right).push_back(nums[i]);
sort(left.begin(), left.end());
sort(right.begin(), right.end(), greater<int>());
bool valid = true;
for (int i = 0; i < left.size(); ++i)
if (left[i] < i + 1)
valid = false;
for (int i = 0; i < right.size(); ++i)
if (right[i] > n - i)
valid = false;
cout << (valid ? "YES" : "NO") << '\n';
}
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
}
Red or blue ball โ
Kickdrum
int CalcMin(int K, int N, vector<int>& Qp, vector<int>& S, vector<int>& P) {
int min_students = N + 1;
vector<int> cumulative_powers(K, 0);
int left = 0;
for (int right = 0; right < N; ++right) {
cumulative_powers[S[right] - 1] += P[right];
bool all_satisfied = true;
for (int i = 0; i < K; ++i) {
if (cumulative_powers[i] < Qp[i]) {
all_satisfied = false;
break;
}
}
while (all_satisfied) {
min_students = min(min_students, right - left + 1);
cumulative_powers[S[left] - 1] -= P[left];
++left;
all_satisfied = true;
for (int i = 0; i < K; ++i) {
if (cumulative_powers[i] < Qp[i]) {
all_satisfied = false;
break;
}
}
}
}
return (min_students == N + 1) ? -1 : min_students;
}
Clear tax (Team selection) โ
int min_students = N + 1;
vector<int> cumulative_powers(K, 0);
int left = 0;
for (int right = 0; right < N; ++right) {
cumulative_powers[S[right] - 1] += P[right];
bool all_satisfied = true;
for (int i = 0; i < K; ++i) {
if (cumulative_powers[i] < Qp[i]) {
all_satisfied = false;
break;
}
}
while (all_satisfied) {
min_students = min(min_students, right - left + 1);
cumulative_powers[S[left] - 1] -= P[left];
++left;
all_satisfied = true;
for (int i = 0; i < K; ++i) {
if (cumulative_powers[i] < Qp[i]) {
all_satisfied = false;
break;
}
}
}
}
return (min_students == N + 1) ? -1 : min_students;
}
Clear tax (Team selection) โ
๐1๐คฎ1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
vector<int> solve(int node, int n, unordered_map<int, vector<pair<int, int>>>& h) {
vector<int> dist(n + 1, INT_MAX);
unordered_set<int> visited;
dist[node] = 0;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q;
q.push({0, node});
while (!q.empty()) {
int val, currNode;
tie(val, currNode) = q.top();
q.pop();
if (visited.find(currNode) != visited.end()) continue;
visited.insert(currNode);
dist[currNode] = val;
for (const auto& edge : h[currNode]) {
int neighbor, weight;
tie(neighbor, weight) = edge;
if (visited.find(neighbor) == visited.end() && val + weight < dist[neighbor]) {
dist[neighbor] = val + weight;
q.push({dist[neighbor], neighbor});
}
}
}
return dist;
}
int findCentralNode(int nodes, const vector<int>& tree_from, const vector<int>& tree_to, const vector<int>& tree_weight, int x, int y, int z) {
unordered_map<int, vector<pair<int, int>>> h;
int n = nodes;
for (size_t i = 0; i < tree_from.size(); ++i) {
h[tree_from[i]].push_back({tree_to[i], tree_weight[i]});
h[tree_to[i]].push_back({tree_from[i], tree_weight[i]});
}
vector<int> dx = solve(x, n, h);
vector<int> dy = solve(y, n, h);
vector<int> dz = solve(z, n, h);
int ans = INT_MAX;
int mns = -1;
for (int i = 1; i <= n; ++i) {
int val = dx[i] + dy[i] + dz[i];
if (val < ans) {
ans = val;
mns = i;
}
}
return mns;
}
๐1
int solve(int N, int K, const vector<int> houses) {
map<int,int>mp;
for(int i=0;i<houses.size();i++){
mp[houses[i]-1]=i+1;
}
multiset<int>s;
int ans=INT_MAX;
for(int i=0;i<K;i++){
s.insert(mp[i]);
}
ans=*s.rbegin();
for(int i=1;i+K-1<N;i++){
s.erase(s.find(mp[i-1]));
s.insert(mp[i+K-1]);
ans=min(ans,int(*s.rbegin()));
}
return ans;
}
Happy Neighborhood โ
map<int,int>mp;
for(int i=0;i<houses.size();i++){
mp[houses[i]-1]=i+1;
}
multiset<int>s;
int ans=INT_MAX;
for(int i=0;i<K;i++){
s.insert(mp[i]);
}
ans=*s.rbegin();
for(int i=1;i+K-1<N;i++){
s.erase(s.find(mp[i-1]));
s.insert(mp[i+K-1]);
ans=min(ans,int(*s.rbegin()));
}
return ans;
}
Happy Neighborhood โ
def solution(a, b):
c = {}
d = {}
for x, y in b:
if x not in c:
c[x] = 0
d[x] = 0
c[x] += y
d[x] += 1
best_dish = None
max_avg = 0
for x in c:
avg = c[x] / d[x]
if (avg > max_avg) or (avg == max_avg and (best_dish is None or x < best_dish)):
max_avg = avg
best_dish = x
print(best_dish)
def main():
a = int(input())
b = [tuple(map(int, input().split())) for _ in range(a)]
solution(a, b)
if name == "main":
main()
Food Ratings โ
c = {}
d = {}
for x, y in b:
if x not in c:
c[x] = 0
d[x] = 0
c[x] += y
d[x] += 1
best_dish = None
max_avg = 0
for x in c:
avg = c[x] / d[x]
if (avg > max_avg) or (avg == max_avg and (best_dish is None or x < best_dish)):
max_avg = avg
best_dish = x
print(best_dish)
def main():
a = int(input())
b = [tuple(map(int, input().split())) for _ in range(a)]
solution(a, b)
if name == "main":
main()
Food Ratings โ
int getSpecialSubstring(string s, int k, string charValue) {
unordered_map<char, bool> is_normal;
for (int i = 0; i < 26; i++) {
is_normal['a' + i] = (charValue[i] == '0');
}
int left = 0;
int max_length = 0;
int normal_count = 0;
for (int right = 0; right < s.length(); right++) {
if (is_normal[s[right]]) {
normal_count += 1;
}
while (normal_count > k) {
if (is_normal[s[left]]) {
normal_count -= 1;
}
left += 1;
}
max_length = max(max_length, right - left + 1);
}
return max_length;
}
unordered_map<char, bool> is_normal;
for (int i = 0; i < 26; i++) {
is_normal['a' + i] = (charValue[i] == '0');
}
int left = 0;
int max_length = 0;
int normal_count = 0;
for (int right = 0; right < s.length(); right++) {
if (is_normal[s[right]]) {
normal_count += 1;
}
while (normal_count > k) {
if (is_normal[s[left]]) {
normal_count -= 1;
}
left += 1;
}
max_length = max(max_length, right - left + 1);
}
return max_length;
}
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: CloudSEK
Role: SDE Intern
Batch eligible: 2025 and 2026 grads
Apply: https://www.linkedin.com/jobs/view/4071357511/
Role: SDE Intern
Batch eligible: 2025 and 2026 grads
Apply: https://www.linkedin.com/jobs/view/4071357511/
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: McAfee
Role: Graduate Technical Intern
Batch eligible: 2025 and 2026 grads
Apply: https://careers.mcafee.com/global/en/job/MCAFGLOBALJR0031349ENGLOBALEXTERNAL/Graduate-Technical-Intern
Role: Graduate Technical Intern
Batch eligible: 2025 and 2026 grads
Apply: https://careers.mcafee.com/global/en/job/MCAFGLOBALJR0031349ENGLOBALEXTERNAL/Graduate-Technical-Intern
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Batch: 2024, 2025
careers@innobyteservices.com
careers@innobyteservices.com
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Python Developer
โข Requirements: Proficiency in Python, knowledge of web frameworks (Django/Flask), and understanding of databases (SQL/NoSQL).
iOS Developer
โข Requirements: Proficiency in Swift/Objective-C, experience with iOS frameworks (UIKit, Core Data), and understanding of RESTful APIs.
Frontend Developer
โข Requirements: Proficiency in HTML, CSS, JavaScript, experience with frontend frameworks (React/Angular/Vue.js), and understanding of responsive design.
๐จSend your resume to hr@technostacks.com
OR
Connect : +91 9909712617
โข Requirements: Proficiency in Python, knowledge of web frameworks (Django/Flask), and understanding of databases (SQL/NoSQL).
iOS Developer
โข Requirements: Proficiency in Swift/Objective-C, experience with iOS frameworks (UIKit, Core Data), and understanding of RESTful APIs.
Frontend Developer
โข Requirements: Proficiency in HTML, CSS, JavaScript, experience with frontend frameworks (React/Angular/Vue.js), and understanding of responsive design.
๐จSend your resume to hr@technostacks.com
OR
Connect : +91 9909712617
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Company Name : Indmoney
Role : Machine Learning Intern
Degree : B.Tech - Computer Science or IT and M.Sc. in computer science or MCA
Batch : 2025,2026,2027
Internship duration: 6 Months
Skill Set : Python and scikit-learn or PyTorch in any of your projects
Location : Bangalore
๐ปApply Link: https://docs.google.com/forms/d/e/1FAIpQLSdKgT_x8aZmh0dMUcdzQmoH0HJenSEYHbRe9D4_F6bayft-HA/viewform
Role : Machine Learning Intern
Degree : B.Tech - Computer Science or IT and M.Sc. in computer science or MCA
Batch : 2025,2026,2027
Internship duration: 6 Months
Skill Set : Python and scikit-learn or PyTorch in any of your projects
Location : Bangalore
๐ปApply Link: https://docs.google.com/forms/d/e/1FAIpQLSdKgT_x8aZmh0dMUcdzQmoH0HJenSEYHbRe9D4_F6bayft-HA/viewform
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Company Name : PayU
Role : Data Intern
Degree : Engineering, Statistics, Computer Science, Mathematics or other similar quantitative fields from a premier institute
Batch : 2025,2026,2027
Internship duration: 2 โ 12 months
Skill Set : Excellent understanding of SQL, Python.
Location : Mumbai, Bangalore, Gurgaon
๐ปApply Link: https://jobs.eu.lever.co/payu/ee2691f3-64c7-4251-9284-e91aa40b2932
Role : Data Intern
Degree : Engineering, Statistics, Computer Science, Mathematics or other similar quantitative fields from a premier institute
Batch : 2025,2026,2027
Internship duration: 2 โ 12 months
Skill Set : Excellent understanding of SQL, Python.
Location : Mumbai, Bangalore, Gurgaon
๐ปApply Link: https://jobs.eu.lever.co/payu/ee2691f3-64c7-4251-9284-e91aa40b2932
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Company Name : Kirana Club
Batch : 2025 passouts
Role : 6 Months Internship - Full Stack/React Native/Product and a few non tech.
Stipend : 25,000-40,000 INR per month
๐ปApply Link : http://kirana.club/internship2025
Batch : 2025 passouts
Role : 6 Months Internship - Full Stack/React Native/Product and a few non tech.
Stipend : 25,000-40,000 INR per month
๐ปApply Link : http://kirana.club/internship2025
Kirana Club - India's Largest Kirana Network
Looking for your next Adventure? | Kirana Club Internship 2025
Weโre looking for sharp minds to join our team across all verticals โ and it could be you!
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Nxt Semiconductor Hiring
Role : Internship
Duration : 11 to 12 months
Stipend : 30k monthly
Batch : 2023, 2024,2025
Link : https://nxp.wd3.myworkdayjobs.com/careers/job/Bangalore-Nagavara/Internship---Software-Development--2024-_R-10052539
Role : Internship
Duration : 11 to 12 months
Stipend : 30k monthly
Batch : 2023, 2024,2025
Link : https://nxp.wd3.myworkdayjobs.com/careers/job/Bangalore-Nagavara/Internship---Software-Development--2024-_R-10052539
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Sign Up | LinkedIn
500 million+ members | Manage your professional identity. Build and engage with your professional network. Access knowledge, insights and opportunities.
def solve(N, K, X, A):
count = 0
for subset_mask in range(1 << N):
subset = [A[i] for i in range(N) if (subset_mask & (1 << i))]
v = 0
for start in range(len(subset)):
segment_sum = 0
for end in range(start, len(subset)):
segment_sum += subset[end]
if segment_sum >= X:
v += 1
if v >= K:
count += 1
return count
UST โ
count = 0
for subset_mask in range(1 << N):
subset = [A[i] for i in range(N) if (subset_mask & (1 << i))]
v = 0
for start in range(len(subset)):
segment_sum = 0
for end in range(start, len(subset)):
segment_sum += subset[end]
if segment_sum >= X:
v += 1
if v >= K:
count += 1
return count
UST โ
๐1