#include<bits/stdc++.h> using namespace std; class Solution { public: string answerString(string word, int numFriends) { int N = word.size(); if(numFriends ==1) return word; char c = *max_element(word.begin(), word.end()); string max_string = ""; for(int pos=0; pos<N; pos++) { if(word[pos] == c){ int l_allowed = min((int)(N - pos), N - numFriends +1); if(l_allowed <=0) continue; string s = word.substr(pos, l_allowed); if(s > max_string){ max_string = s; } } } return max_string; } };
@ITWorld-tutorialКүн бұрын
d pleaseeeeeeeeeeeeee
@ITWorld-tutorialКүн бұрын
d please i subscribed to you
@Code-Review-c91Күн бұрын
#include <bits/stdc++.h> using namespace std; pair<long long, int> computeLucky(long long left, long long right, int threshold) { if (right - left + 1 < threshold) { return {0, 0}; } if (right - left + 1 == 1) { return {left, 1}; } long long mid = left + (right - left) / 2; if ((right - left + 1) % 2) { pair<long long, int> leftResult = computeLucky(left, mid - 1, threshold); long long totalLucky = mid + 2 * leftResult.first + mid * leftResult.second; int totalSegments = 2 * leftResult.second + 1; return {totalLucky, totalSegments}; } else { pair<long long, int> leftResult = computeLucky(left, mid, threshold); long long totalLucky = 2 * leftResult.first + mid * leftResult.second; int totalSegments = 2 * leftResult.second; return {totalLucky, totalSegments}; } } int main() { ios::sync_with_stdio(false); cin.tie(NULL); int test_cases; cin >> test_cases; while (test_cases--) { long long n, k; cin >> n >> k; pair<long long, int> result = computeLucky(1, n, k); cout << result.first << " "; } return 0; }
@MultiUniverseExploreКүн бұрын
Thanku bro 100 % correct code
@aaadcat11Күн бұрын
how a
@aaadcat11Күн бұрын
Thanku
@DefylogicguyКүн бұрын
I got tle somehow
@Tamil_vlogss4 күн бұрын
can you please share your code text file
@Xavier-me7yk4 күн бұрын
Becuase of guys like CP has lost its value idiots😢
@rifat89404 күн бұрын
thank you broh
@Code-Review-c914 күн бұрын
Subscribe to my channel which supports me and you will get the video of the contest on that channel soon.
@MultiUniverseExplore4 күн бұрын
Thanks
@CuteLoveTales4 күн бұрын
Very helpful
@CuteLoveTales4 күн бұрын
Thanku bro ❤❤
@Code-Review-c915 күн бұрын
I didn't have time so there is a code in the telegram group
@Code-Review-c915 күн бұрын
Seen teligram group c
@ITWorld-tutorial5 күн бұрын
please c pleaseeeeeeeeeeeeeeeeeeeee
@Code-Review-c915 күн бұрын
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<int> determineDigits(ll n, ll d) { vector<int> ans; // Always include 1 ans.push_back(1); // Include 3 if n >= 3 or d is divisible by 3 if (n >= 3 || d % 3 == 0) { ans.push_back(3); } // Include 5 if d is 5 if (d == 5) { ans.push_back(5); } // Include 7 if n >= 3 or (n == 2 and d == 7) if (n >= 3 || (n == 2 && d == 7)) { ans.push_back(7); } // Include 9 if special condition or n >= 6 if (n >= 6) { ans.push_back(9); } else { ll factorial = 1; int i = 2; while (i <= n) { factorial *= i; i++; } if ((factorial * d) % 9 == 0) { ans.push_back(9); } } return ans; } int main() { int t; cin >> t; while (t--) { ll n, d; cin >> n >> d; vector<int> ans = determineDigits(n, d); for (int digit : ans) { cout << digit << " "; } cout << " "; } return 0; }
@ITWorld-tutorial5 күн бұрын
pleaseeeeeeeeeeeeeee c
@worldsvideos12345 күн бұрын
Give the code in description
@worldsvideos12345 күн бұрын
Please
@worldsvideos12345 күн бұрын
Please write the code in description
@worldsvideos12345 күн бұрын
Hii
@Code-Review-c915 күн бұрын
Subscribe and like
@ITWorld-tutorial5 күн бұрын
please give c i did all thinks that you said
@Code-Review-c915 күн бұрын
It is important to make the correct code, due to which it got delayed bro
@Code-Review-c915 күн бұрын
Wait 1 min
@ITWorld-tutorial5 күн бұрын
pleaaaaaaaaaaaaase B
@ITWorld-tutorial5 күн бұрын
pleaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaase B
@worldsvideos12345 күн бұрын
Fast
@worldsvideos12345 күн бұрын
B pls
@worldsvideos12345 күн бұрын
B
@worldsvideos12345 күн бұрын
Do u the secnd one
@ITWorld-tutorial5 күн бұрын
please B
@KaushlendraSinghYadav-gt5ft5 күн бұрын
gzb
@comedyvideoss76156 күн бұрын
Good
@hardikbishnoi29087 күн бұрын
Wrong answer on test 1
@Code-Review-c917 күн бұрын
@@hardikbishnoi2908 accept all test cases, you should try again or else if not then take the code from telegram group and see
Look brother, we provide 100% correct solutions and never give wrong codes, that's why it takes time to make the coding but I try to upload it fast.
@Code-Review-c917 күн бұрын
Wait 1 min
@ITWorld-tutorial7 күн бұрын
please e
@anujpaul277 күн бұрын
Thank you sister. 💌
@ITWorld-tutorial7 күн бұрын
do you have e please
@RandomWork-s7v7 күн бұрын
C????
@RandomWork-s7v7 күн бұрын
Problem c?
@murthy.g85767 күн бұрын
code?
@Code-Review-c917 күн бұрын
@@murthy.g8576 seen teligram group
@Code-Review-c917 күн бұрын
subscribe and take all code fast c and d join this telegram group
@Code-Review-c919 күн бұрын
#include <iostream> #include <vector> #include <algorithm> #include <climits> using namespace std; bool solve(int n, string &s) { vector<int> p(n, INT_MAX); // To store the prefix minimum for 'p' vector<int> s_arr(n, INT_MAX); // To store the suffix minimum for 's' // Step 1: Assign values for 'p' and 's' for (int i = 0; i < n; ++i) { if (s[i] == 'p') { p[i] = i + 1; // p[i] should be i + 1 (1-based index) } if (s[i] == 's') { s_arr[i] = n - i; // s[i] should be n - i } } // Step 2: Propagate forward in s_arr to ensure suffix min constraint for (int i = 1; i < n; ++i) { s_arr[i] = min(s_arr[i], s_arr[i - 1]); } // Step 3: Propagate backward in p to ensure prefix min constraint for (int i = n - 2; i >= 0; --i) { p[i] = min(p[i], p[i + 1]); } // Step 4: Create the temp array with the minimum of p[i] and s_arr[i] vector<int> temp(n); for (int i = 0; i < n; ++i) { temp[i] = min(s_arr[i], p[i]); } // Step 5: Sort the temp array vector<int> sorted_temp = temp; sort(sorted_temp.begin(), sorted_temp.end()); // Step 6: Check if sorted_temp[i] >= i + 1 for all i for (int i = 0; i < n; ++i) { if (sorted_temp[i] < i + 1) { return false; // If any element fails the condition, return false } } return true; } int main() { int t; cin >> t; // Read number of test cases while (t--) { int n; string s; cin >> n >> s; // Read n and the string s if (solve(n, s)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
@comedyvideoss76159 күн бұрын
Good
@comedyvideoss76159 күн бұрын
Goood
@Code-Review-c9114 күн бұрын
public class ButtonWithLongestTime { public int buttonWithLongestTime(int[][] events) { int longestTime = events[0][1]; int longestButton = events[0][0]; for (int i = 1; i < events.length; i++) { int duration = events[i][1] - events[i - 1][1]; if (duration > longestTime || (duration == longestTime && events[i][0] < longestButton)) { longestTime = duration; longestButton = events[i][0]; } } return longestButton; } public static void main(String[] args) { ButtonWithLongestTime solution = new ButtonWithLongestTime(); int[][] events = { {0, 2}, {1, 5}, {0, 9}, {2, 15} }; int result = solution.buttonWithLongestTime(events); System.out.println("Button with the longest time: " + result); } }
@Monkey_D_Luffy_3014 күн бұрын
Code
@Code-Review-c9114 күн бұрын
Subscribe to the channel or get total code time or join telegram group