Get All Coding Solutions
Want to Increase Your Ranking, You Can Pay ,
25 per Solution
π¬Send Screenshot : DM Here
Todays Free Solutions π
Note: If you share our solution with others, we will not be held responsible for any plagiarism issues that may arise, and we will not provide any assistance in such cases.
NOTE :- Don’t copy the full code — use the logic.
We're not responsible for plagiarism issues For FREE SOLUTION.
Thank you
Q1Solution :
#include <bits/stdc++.h>
using namespace std;
// Solution By Larning Unique
bool validatePair(int delta, int gamma) {
int upper = max(delta, gamma), lower = min(delta, gamma);
return upper <= 2 * (lower + 1); // Solution By Larning Unique
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int queryCount;
if (!(cin >> queryCount)) return 0;
while (queryCount--) {
int alpha, beta, sigma, tau;
cin >> alpha >> beta >> sigma >> tau;
bool conditionOne = validatePair(alpha, beta); // Solution By Larning Unique
bool conditionTwo = validatePair(sigma - alpha, tau - beta); // Solution By Larning Unique
cout << (conditionOne && conditionTwo ? "YES\n" : "NO\n"); // Solution By Larning Unique
}
return 0; // Solution By Larning Unique
}
Q2 Solution :
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
// Solution By Larning Unique
void processTestCase() {
int lengthOfStream;
int maxAllowedStreak;
std::cin >> lengthOfStream >> maxAllowedStreak;
std::string binarySequence;
std::cin >> binarySequence;
int longestStreak = 0;
int currentStreak = 0;
// Solution By Larning Unique
for (char bitChar : binarySequence) {
if (bitChar == '1') {
currentStreak++;
} else {
longestStreak = std::max(longestStreak, currentStreak);
currentStreak = 0;
}
}
longestStreak = std::max(longestStreak, currentStreak); // Solution By Larning Unique
if (longestStreak >= maxAllowedStreak) {
std::cout << "NO\n";
return;
}
std::cout << "YES\n";
std::vector<int> finalPermutation(lengthOfStream);
std::vector<int> oneBitIndices;
std::vector<int> zeroBitIndices;
// Solution By Larning Unique
for (int position = 0; position < lengthOfStream; ++position) {
if (binarySequence[position] == '1') {
oneBitIndices.push_back(position);
} else {
zeroBitIndices.push_back(position);
}
}
int assignedNumber = 1;
for (int pos : oneBitIndices) {
finalPermutation[pos] = assignedNumber++;
}
for (int pos : zeroBitIndices) {
finalPermutation[pos] = assignedNumber++;
}
// Solution By Larning Unique
for (int index = 0; index < lengthOfStream; ++index) {
std::cout << finalPermutation[index] << (index == lengthOfStream - 1 ? "" : " ");
}
std::cout << "\n"; // Solution By Larning Unique
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int numberOfTests;
std::cin >> numberOfTests;
while (numberOfTests--) {
processTestCase(); // Solution By Larning Unique
}
return 0;
}
telegram link not opening
ReplyDeleteshare WhatsApp
broooo, please give B
ReplyDeleteB karde yaar
ReplyDeletehello
ReplyDeletekisko answer chahie
ReplyDeleteHint dedo bus b ka ans nhi chahiye
Deleteb ka bta do
DeleteC dedo bas ek chahiye
ReplyDeletewhere B solutions?
ReplyDeleteneed a
ReplyDeleteneed a
ReplyDeletewhere are the solutions
ReplyDeletepayed bro where to get solution ??
ReplyDelete