Foto
Got selected for IBM & Got IBM letter 🥳🥳 🎉🎉 ✅✅
IBM CIC recruitment process :
IBM coding(online) ✅
Communication(online) ✅
Coding(offline) ✅
video recorded session (offline) ✅
GD(offline) ✅
Interview (offline ) ✅
We cleared each and everything through guidance and finally we delivered ✅
💯 Clearance for any exam and interview ✅
Contact: @MLCODER2
1.2K · import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
int[] arr = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = sc.nextInt();
}
double avg= 0;
int sum = 0;
for (int i = 0; i < K; i++) {
sum += arr[i];
}
avg = (double) sum / K;
for (int i = K; i < N; i++) {
sum = sum - arr[i - K] + arr[i];
double cur = (double) sum / K;
if (cur > avg) {
avg = cur;
}
}
System.out.printf("%.2f\n", avg);
sc.close();
}
}
#BIRLASOFT
930 · public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n= sc.nextInt();
int x=sc.nextInt();
int[] arr=new int[n];
for(int i=0;i<n;i++) {
arr[i] = sc.nextInt();
}
System.out.println(Arrays.binarySearch(arr,x)>=0 ? (Arrays.binarySearch(arr,x)):-1);
}
}
#BIRLASOFT
978 · def solve(N):
sum_needed = (N * (N + 1)) // 2
k = ((N + 1) * (N + 2)) // 2
count = 0
total = 0
for i in range(N + 1, 0, -1):
if total >= sum_needed:
break
total += i
count += 1
return count
#Get_Ribbon
#BNY
932 ·