π Minimum Cost for Tickets β Python Solution Executed π―β
from bisect import bisect_left
m = int(raw_input())
days = list(map(int, raw_input().split()))
cost = list(map(int, raw_input().split()))
dp = {}
def solve(i, t):
if i == m:
return 0
if (i, t) in dp:
return dp[(i, t)]
ans = cost[0] + solve(i + 1, t)
if t:
ans = min(ans, solve(i + 1, t - 1))
j = bisect_left(days, days[i] + 7)
ans = min(ans, cost[1] + solve(j, t + 1))
j = bisect_left(days, days[i] + 30)
ans = min(ans, cost[2] + solve(j, t + 2))
dp[(i, t)] = ans
return ans
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
print(solve(0, 0))
π WhatsApp Channel: https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
β Stay connected & share with your friends for more coding solutions, OA updates, and placement support!
from bisect import bisect_left
m = int(raw_input())
days = list(map(int, raw_input().split()))
cost = list(map(int, raw_input().split()))
dp = {}
def solve(i, t):
if i == m:
return 0
if (i, t) in dp:
return dp[(i, t)]
ans = cost[0] + solve(i + 1, t)
if t:
ans = min(ans, solve(i + 1, t - 1))
j = bisect_left(days, days[i] + 7)
ans = min(ans, cost[1] + solve(j, t + 1))
j = bisect_left(days, days[i] + 30)
ans = min(ans, cost[2] + solve(j, t + 2))
dp[(i, t)] = ans
return ans
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
print(solve(0, 0))
π WhatsApp Channel: https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
β Stay connected & share with your friends for more coding solutions, OA updates, and placement support!
π¨ 100% TEST CASES PASSED β
π₯
π Minimum Number of Operations to Form Target Array β C++ Solution Available π―
β‘ Optimized Approach
β All Test Cases Passed
π OA Ready Code
π» Clean & Efficient Implementation
#include <bits/stdc++.h>
using namespace std;
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
long long solve(int N, vector<int>& target) {
long long total = 0;
for (int i = 0; i < N; i++) total += target[i];
long long sumX = 0;
long long carry = 0;
for (int i = 0; i + 1 < N; i++) {
long long cap = min((long long)target[i] - carry,
(long long)target[i + 1]);
if (cap < 0) cap = 0;
sumX += cap;
carry = cap;
}
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
return total - sumX;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin >> N;
vector<int> target(N);
for (int i = 0; i < N; i++)
cin >> target[i];
cout << solve(N, target) << '\n';
return 0;
}
π WhatsApp Channel: https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
β Join Now for Daily OA Solutions, Placement Updates & Interview Support! π
π Minimum Number of Operations to Form Target Array β C++ Solution Available π―
β‘ Optimized Approach
β All Test Cases Passed
π OA Ready Code
π» Clean & Efficient Implementation
#include <bits/stdc++.h>
using namespace std;
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
long long solve(int N, vector<int>& target) {
long long total = 0;
for (int i = 0; i < N; i++) total += target[i];
long long sumX = 0;
long long carry = 0;
for (int i = 0; i + 1 < N; i++) {
long long cap = min((long long)target[i] - carry,
(long long)target[i + 1]);
if (cap < 0) cap = 0;
sumX += cap;
carry = cap;
}
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
return total - sumX;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin >> N;
vector<int> target(N);
for (int i = 0; i < N; i++)
cin >> target[i];
cout << solve(N, target) << '\n';
return 0;
}
π WhatsApp Channel: https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
β Join Now for Daily OA Solutions, Placement Updates & Interview Support! π
π Thermostat Schedule β C++ Solution Executed π―β
π₯ 100% Test Cases Passed
β‘ Optimized O(N) Solution
π» Clean & OA Ready Code
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N;
if (!(cin >> N)) return 0;
vector<long long> t(N);
for (int i = 0; i < N; ++i)
cin >> t[i];
bool is_sorted = true;
for (int i = 0; i < N - 1; ++i) {
if (t[i] > t[i + 1]) {
is_sorted = false;
break;
}
}
if (is_sorted) {
long long total_sum = 0;
for (long long x : t)
total_sum += x;
cout << 0 << "\n" << total_sum << "\n";
return 0;
}
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
vector<long long> suffix_min(N);
suffix_min[N - 1] = t[N - 1];
for (int i = N - 2; i >= 0; --i)
suffix_min[i] = min(t[i], suffix_min[i + 1]);
long long max_sum = 0;
long long prefix_sum = 0;
for (int i = 0; i < N; ++i) {
long long prev = (i == 0 ? 0 : t[i - 1]);
long long val = suffix_min[i];
if (val >= prev) {
long long cur = prefix_sum + 1LL * (N - i) * val;
max_sum = max(max_sum, cur);
}
if (i < N - 1 && t[i] > t[i + 1])
break;
prefix_sum += t[i];
}
cout << 1 << "\n" << max_sum << "\n";
return 0;
}
π© DM: @Mrtrueliving_ix
π 9030793510
π WhatsApp Channel: https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
β Stay connected & share with your friends for more OA coding solutions, interview questions, and placement updates! π
π₯ 100% Test Cases Passed
β‘ Optimized O(N) Solution
π» Clean & OA Ready Code
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N;
if (!(cin >> N)) return 0;
vector<long long> t(N);
for (int i = 0; i < N; ++i)
cin >> t[i];
bool is_sorted = true;
for (int i = 0; i < N - 1; ++i) {
if (t[i] > t[i + 1]) {
is_sorted = false;
break;
}
}
if (is_sorted) {
long long total_sum = 0;
for (long long x : t)
total_sum += x;
cout << 0 << "\n" << total_sum << "\n";
return 0;
}
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
vector<long long> suffix_min(N);
suffix_min[N - 1] = t[N - 1];
for (int i = N - 2; i >= 0; --i)
suffix_min[i] = min(t[i], suffix_min[i + 1]);
long long max_sum = 0;
long long prefix_sum = 0;
for (int i = 0; i < N; ++i) {
long long prev = (i == 0 ? 0 : t[i - 1]);
long long val = suffix_min[i];
if (val >= prev) {
long long cur = prefix_sum + 1LL * (N - i) * val;
max_sum = max(max_sum, cur);
}
if (i < N - 1 && t[i] > t[i + 1])
break;
prefix_sum += t[i];
}
cout << 1 << "\n" << max_sum << "\n";
return 0;
}
π© DM: @Mrtrueliving_ix
π 9030793510
π WhatsApp Channel: https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
β Stay connected & share with your friends for more OA coding solutions, interview questions, and placement updates! π
β€1
π¨ Important Update for Infosys Candidates
Those who missed their assessment due to login issues or other technical problems may receive a new assessment date.
π© Kindly check your registered email regularly for any updates or rescheduling information.
If you're facing any issues, feel free to contact us:
@Mrtrueliving_ix
@Mrtrueliving_09
π 9030793510
β οΈ Keep checking your inbox and spam folder. Don't miss the update!
Those who missed their assessment due to login issues or other technical problems may receive a new assessment date.
π© Kindly check your registered email regularly for any updates or rescheduling information.
If you're facing any issues, feel free to contact us:
@Mrtrueliving_ix
@Mrtrueliving_09
π 9030793510
β οΈ Keep checking your inbox and spam folder. Don't miss the update!
*FINAL CALL β INFOSYS Exam Help*
*Those who want HELP to CLEAR the INFOSYS Assessment, contact us now! β *
π Available Slots: βͺοΈ 10:00 AM βͺοΈ 2:00 PM
*β οΈ Last Few Slots Remaining!*
π© DM Contact: @Mrtrueliving_ix // @Mrtrueliving_09
9030793510 // 9030793510
*Those who want HELP to CLEAR the INFOSYS Assessment, contact us now! β *
π Available Slots: βͺοΈ 10:00 AM βͺοΈ 2:00 PM
*β οΈ Last Few Slots Remaining!*
π© DM Contact: @Mrtrueliving_ix // @Mrtrueliving_09
9030793510 // 9030793510
π Infosys 10:00 AM Exam Help Completed Successfully! β
π― 100% accurate execution with plagiarism-free coding support.
Need help with:
β’ Placement Tests
β’ Technical Interviews
β’ Coding Questions
β’ OA Preparation
π© DM for Placement & Interview Help
π© DM for Coding Support
π @Mrtrueliving_ix
π¨π₯ INFOSYS 10:00 AM SLOT β COMPLETED! π₯π¨
β ALL 10:00 AM SLOTS ARE DONE π―
β‘ Plagiarism-Free Coding Support
β‘ High Execution Accuracy
β‘ OA β’ Coding β’ Technical Interview Assistance
π― Next Slot? Be Ready Before the Exam Starts!
π© DM NOW
π @Mrtrueliving_ix
Fast Response β’ Limited Support Slots π
Infosys 2 pm Slots are Available now
π1
N = int(raw_input())
K = int(raw_input())
prices = map(int, raw_input().split())
dp = [0] * N
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
for j in range(N):
if j > 0:
dp[j] = dp[j - 1]
if j >= K:
dp[j] = max(dp[j], dp[j - K] + prices[j] - prices[j - K])
print(max(dp) if N else 0)
ββββββββββββββββββββββββββββββ
π₯ FREE OA CODE DROP π₯
ββββββββββββββββββββββββββββββ
π Problem: Best Time to Buy & Sell Stock II
β Plagiarism-Free Solution
β Optimized & Submission Ready
β Suitable for OA & Coding Assessments
ββββββββββββββββββββββ
π’ Don't keep it to yourself!
π Forward this post to your friends and placement groups.
Helping one candidate today could help them land a job tomorrow. β€οΈ
π² Join our FREE WhatsApp Channel
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
π Daily OA Codes β’ Interview Questions β’ Placement Updates β’ Job Alerts
K = int(raw_input())
prices = map(int, raw_input().split())
dp = [0] * N
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
for j in range(N):
if j > 0:
dp[j] = dp[j - 1]
if j >= K:
dp[j] = max(dp[j], dp[j - K] + prices[j] - prices[j - K])
print(max(dp) if N else 0)
ββββββββββββββββββββββββββββββ
π₯ FREE OA CODE DROP π₯
ββββββββββββββββββββββββββββββ
π Problem: Best Time to Buy & Sell Stock II
β Plagiarism-Free Solution
β Optimized & Submission Ready
β Suitable for OA & Coding Assessments
ββββββββββββββββββββββ
π’ Don't keep it to yourself!
π Forward this post to your friends and placement groups.
Helping one candidate today could help them land a job tomorrow. β€οΈ
π² Join our FREE WhatsApp Channel
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
π Daily OA Codes β’ Interview Questions β’ Placement Updates β’ Job Alerts
β On-Campus Exam Help Completed! π
Successfully assisted through live picture sharing. πΈ
Need Placement Interview Help or Placement Support?
π© DM:
@Mrtrueliving_ix
@Mrtrueliving_ix
π From Online Assessment to Interview Preparation β we're here to support your placement journey.
π¨ INFOSYS 2 PM EXAM β DONE SUCCESSFULLY! π―π₯
β 100% Plagiarism-Free Coding
β All Hidden Test Cases Passed
β Real-Time Exam Support
β Fast β’ Accurate β’ Reliable
π Another Successful Assessment Completed!
π Need help with your upcoming Placement Exams or Interviews?
π© DM Now:
@Mrtrueliving_ix
@Mrtrueliving_ix
*π¨π₯ FULL PYTHON CODE RELEASED π₯π¨*
π» Problem: Length of Longest Sequences
β Optimized Dynamic Programming Solution
β Clean & Easy to Understand
β Placement OA Ready
β Python 3
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
import sys
input = sys.stdin.readline
def solve(N, target, nums):
dp = [[-1] * (target + 1) for _ in range(N + 5)]
for i in range(N + 5):
dp[i][0] = 0
for i in range(N - 1, -1, -1):
val = nums[i]
nxt = min(N, i + (val % 4) + 1)
for s in range(target + 1):
dp[i][s] = dp[i + 1][s]
if val <= s and dp[nxt][s - val] != -1:
dp[i][s] = max(dp[i][s], dp[nxt][s - val] + 1)
return dp[0][target]
if name == "main":
try:
N = int(input())
target = int(input())
nums = list(map(int, input().split()))
print(solve(N, target, nums))
except (EOFError, ValueError):
pass
π For More Coding Questions, OA Solutions, Interview Preparation & Placement Updates, Join Our WhatsApp Channel:
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
π Daily Updates | OA Questions | Interview Help | Placement Support
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
π£ Knowledge grows when it's shared! π
π Forward this code to your friends, classmates, and placement groups.
π Your one share could be the reason someone clears their OA and gets placed. π€
π» Problem: Length of Longest Sequences
β Optimized Dynamic Programming Solution
β Clean & Easy to Understand
β Placement OA Ready
β Python 3
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
import sys
input = sys.stdin.readline
def solve(N, target, nums):
dp = [[-1] * (target + 1) for _ in range(N + 5)]
for i in range(N + 5):
dp[i][0] = 0
for i in range(N - 1, -1, -1):
val = nums[i]
nxt = min(N, i + (val % 4) + 1)
for s in range(target + 1):
dp[i][s] = dp[i + 1][s]
if val <= s and dp[nxt][s - val] != -1:
dp[i][s] = max(dp[i][s], dp[nxt][s - val] + 1)
return dp[0][target]
if name == "main":
try:
N = int(input())
target = int(input())
nums = list(map(int, input().split()))
print(solve(N, target, nums))
except (EOFError, ValueError):
pass
π For More Coding Questions, OA Solutions, Interview Preparation & Placement Updates, Join Our WhatsApp Channel:
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
π Daily Updates | OA Questions | Interview Help | Placement Support
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
π£ Knowledge grows when it's shared! π
π Forward this code to your friends, classmates, and placement groups.
π Your one share could be the reason someone clears their OA and gets placed. π€
π¨π INFOSYS 2 PM | 2/2 SLOTS COMPLETED SUCCESSFULLY! ππ¨
β All Slots Completed
π― Verified Coding Solutions
β All Test Cases Passed
β‘ Fast & Reliable Exam Support
π Congratulations to everyone who successfully completed today's assessment!
π Need Help for Upcoming Placement Exams?
πΌ OA Coding Assistance
π» Verified Solutions
π― Interview Support
π Placement Guidance
π© DM Now:
@Mrtrueliving_09
@Mrtrueliving_09
Company name: Salesforce
Role: Software Engineer - AMTS
Batch Eligible: 2026 graduates
Location: Hyderabad/Bangalore, India
Expected CTC: INR 45 LPA
Community for Quick instant Jobs and Internships Updates
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
Apply Link: https://bit.ly/4hK83zt
Do share with your Friends too
Role: Software Engineer - AMTS
Batch Eligible: 2026 graduates
Location: Hyderabad/Bangalore, India
Expected CTC: INR 45 LPA
Community for Quick instant Jobs and Internships Updates
https://whatsapp.com/channel/0029VahiS3p2v1IyoS891Y1g
Apply Link: https://bit.ly/4hK83zt
Do share with your Friends too
Myworkdayjobs
Software Engineering AMTS
To get the best candidate experience, please consider applying for a maximum of 3 roles within 12 months to ensure you are not duplicating efforts. About Futureforce University Recruiting Our Futureforce University Recruiting program is dedicated to attractingβ¦
β Thoughtworks Referral Exam Help Done Successfully! π
Need placement support for Online Assessments, Interviews, or Referral Exams?
π© Contact:
@Mrtrueliving_09
@Mrtrueliving_09
π End-to-end Placement Support for Freshers & Experienced Candidates.
β€1
π₯ Accenture MCQ Round 1 β CLEARED β
π― Next Round Eligibility Confirmed!
https://t.me/Code_alphix/11189
Want to clear your Placement Tests & Interviews with confidence?
π― Online Assessment β’ Coding β’ Interview Support
π© DM NOW
π @Mrtrueliving_ix
π @Mrtrueliving_ix
β‘ Limited slots available.