IBM Oa Help | Oa Exam Helper
الذهاب إلى القناة على Telegram
We are here to clear All types of Exams Admin : @Codercpp001 (aka) KMK ✅ INTERVIEW HELP AVAILABLE 1-Coding Round 2-Aptitude and Reasoning Round 3-Communication round 4-Resume building 🎉Job updates will be posted here.
إظهار المزيد1 156
المشتركون
لا توجد بيانات24 ساعات
لا توجد بيانات7 أيام
+730 أيام
أرشيف المشاركات
#include <iostream>
#include <vector>
#include <algorithm>
long long solve(int N, std::vector<int>& A) {
std::sort(A.begin(), A.end());
long long minSum = A[0];
int prev = A[0];
for (int i = 1; i < N; ++i) {
if (A[i] <= prev) {
A[i] = prev + 1;
}
prev = A[i];
minSum += A[i];
}
return minSum;
} .. Minimum unique sum 🙃🙃
int n = S.length();
unordered_map leftFreq, rightFreq;
unordered_set leftSet, rightSet;
// Initialize the rightFreq map and rightSet with the entire string S
for (char c : S) {
rightFreq[c]++;
rightSet.insert(c);
}
int maxX = 0;
// Traverse the string and adjust the left and right sets and maps
for (int i = 0; i < n - 1; ++i) {
char c = S[i];
leftFreq[c]++;
rightFreq[c]--;
if (rightFreq[c] == 0) {
rightSet.erase(c);
}
leftSet.insert(c);
int currentSum = leftSet.size() + rightSet.size();
maxX = max(maxX, currentSum);
}
return n - maxX;
#include <vector>
const int MOD = 1000000007;
int countPrettyPartitions(int N, int L, int R, std::vector<int>& A) {
std::vector<int> dp(N + 1, 0);
dp[0] = 1;
for (int i = 1; i <= N; ++i) {
int xor_value = 0;
for (int j = i; j >= 1; --j) {
xor_value ^= A[j - 1];
if (L <= xor_value && xor_value <= R) {
dp[i] = (dp[i] + dp[j - 1]) % MOD;
}
}
}
return dp[N];
} Dividing array
import java.util.*;
public class AnagramSubsequenceFinder {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.nextLine();
int N = sc.nextInt();
sc.nextLine();
String[] W = new String[N];
for (int i = 0; i < N; i++) {
W[i] = sc.nextLine();
}
int[] freqS = getFrequency(S);
int count = 0;
for (String w : W) {
if (isValidAnagramSubsequence(freqS, w)) {
count++;
}
}
System.out.println(count);
}
private static int[] getFrequency(String S) {
int[] freq = new int[26];
for (char c : S.toCharArray()) {
freq[c - 'a']++;
}
return freq;
}
private static boolean isValidAnagramSubsequence(int[] freqS, String w) {
int[] freqW = new int[26];
for (char c : w.toCharArray()) {
freqW[c - 'a']++;
}
for (int i = 0; i < 26; i++) {
if (freqW[i] > freqS[i]) {
return false;
}
}
return true;
}
}
// Minimal substring length
import java.io.*;
import java.util.*;
public class Main {
public static String trim(String str) {
return str.trim();
}
public static int solve(int N, List<Integer> A) {
int totalSum = A.stream().mapToInt(Integer::intValue).sum();
int leftSum = 0;
int equilibriumCount = 0;
for (int i = 0; i < N; ++i) {
int rightSum = totalSum - leftSum - A.get(i);
if (leftSum == rightSum) {
equilibriumCount++;
}
leftSum += A.get(i);
}
return equilibriumCount;
}
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String inputLine = br.readLine();
int N = Integer.parseInt(trim(inputLine));
List<Integer> A = new ArrayList<>();
for (int j = 0; j < N; j++) {
inputLine = br.readLine();
A.add(Integer.parseInt(trim(inputLine)));
}
int result = solve(N, A);
System.out.println(result);
}
}
//Equilbrium path (try)
long long solve(int n,vectorv){
long long ans=0;
sort(v.begin(),v.end());
for(int i=1;i
def twins(a, b):
result = []
for first, second in zip(a, b):
if sorted(first[::2]) == sorted(second[::2]) and sorted(first[1::2]) == sorted(second[1::2]):
result.append('Yes')
else:
result.append('No')
return result
Twin linked ✅
vectorfindSubsequence(vectorarr){
mapm;
vectorans;
int maxi=0;
int n=arr.size();
for(int i=0;i0){
if(arr[i]
متاح الآن! بحث تيليغرام 2025 — أهم رؤى العام 
