ACCENTURE | COGNIZANT | IBM | CAPGEMINI
Kanalga Telegram’da o‘tish
Ko'proq ko'rsatish
7 363
Obunachilar
-524 soatlar
-247 kunlar
-11130 kunlar
Postlar arxiv
AutoRabit exam cleared & next round mail ✅
Contact : @MLCODER2
COGNIZANT TECHNICAL OA HELP AVAILABLE✅
Contact : @MLCODER2
+5
ORACLE ALL SLOTS DONE SUCCESFULLY✅✅
Contact : @MLCODER2
IBM CLEARED & GOT COMMUNICATION MAIL✅
Contact : @MLCODER2
import java.util.*;
class SolutionClass {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int K = sc.nextInt();
String s = sc.next();
Set<Integer>set= new HashSet<>();
for (int i = 0; i < K; i++) set.add(sc.nextInt());
StringBuilder sb = new StringBuilder();
int i = 0;
while (i < n) {
int j = i + 1;
while (j < n && s.charAt(j) == s.charAt(i)) j++;
int len = j - i;
if (!set.contains(len)) {
sb.append(s, i, j);
}
i = j;
}
System.out.println(sb.length() == 0 ? "ERROR" : sb.toString());
}
}
//consecutive characters✅
CAPGEMINI✅
class SolutionClass {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String s = sc.nextLine().trim();
int k= 0;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c >= '0' && c <= '9') k += (c - '0');
}
System.out.println(s + solve(k));
}
private static int solve(int n) {
if (n <= 1) return n;
int a = 0, b = 1;
while (b < n) {
int c = a + b;
a = b;
b = c;
}
return b;
}
}
//kingdom communication✅
CAPGEMINI✅
