Deltax tomorrow Online MCQ round is scheduled at 10AM. PDF of solution that will asked in the OA will be posted here before 9 AM. All the questions will be same from the pdf order of questions may change. All the best :)
๐3๐ฅฐ1
Please let me know,all questions are came from this pdf or not??
Anonymous Poll
52%
Yes
13%
No
35%
Some came out of pdf
๐24๐2โค1
Will update the deltaX pdf in the morning at 8 am.
Stay updated in the group
Stay updated in the group
๐3โค2
๐21
https://youtu.be/cseyBVfuO8o?si=4n6IJNGuUs7XqP60
If u can please subscribe this channel then I will update more such ongoing placement related questions.
If u can please subscribe this channel then I will update more such ongoing placement related questions.
YouTube
DeltaX Coding Question-1||Roman to Integer LeetCode || C++ and JAVA
DeltaX coding question solution
โค11๐2๐ฅ1๐1
DeltaX
Photo
import java.util.*;
public class Main {
public static boolean canPlace(int[] A, int N, int K, int mid) {
int count = 1;
int prev = A[0];
for (int i = 1; i < N; i++) {
if (A[i] - prev >= mid) {
count++;
prev = A[i];
}
}
return count >= K;
}
public static int largestMinDistance(int[] A, int N, int K) {
Arrays.sort(A);
int low = 1;
int high = A[N - 1] - A[0];
while (low <= high) {
int mid = low + (high - low) / 2;
if (canPlace(A, N, K, mid)) {
low = mid + 1;
} else {
high = mid - 1;
}
}
return high;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int K = scanner.nextInt();
int[] A = new int[N];
for (int i = 0; i < N; i++) {
A[i] = scanner.nextInt();
}
int result = largestMinDistance(A, N, K);
System.out.println(result);
}
}
public class Main {
public static boolean canPlace(int[] A, int N, int K, int mid) {
int count = 1;
int prev = A[0];
for (int i = 1; i < N; i++) {
if (A[i] - prev >= mid) {
count++;
prev = A[i];
}
}
return count >= K;
}
public static int largestMinDistance(int[] A, int N, int K) {
Arrays.sort(A);
int low = 1;
int high = A[N - 1] - A[0];
while (low <= high) {
int mid = low + (high - low) / 2;
if (canPlace(A, N, K, mid)) {
low = mid + 1;
} else {
high = mid - 1;
}
}
return high;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int K = scanner.nextInt();
int[] A = new int[N];
for (int i = 0; i < N; i++) {
A[i] = scanner.nextInt();
}
int result = largestMinDistance(A, N, K);
System.out.println(result);
}
}
๐16โค7๐ฅฐ3๐2๐2๐ฅ1๐1
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int M = scanner.nextInt();
int[] A = new int[N];
for (int i = 0; i < N; i++) {
A[i] = scanner.nextInt();
}
Arrays.sort(A);
int minFunctionValue = Integer.MAX_VALUE;
for (int i = 0; i <= N - M; i++) {
int currentFunctionValue = A[i + M - 1] - A[i];
if (currentFunctionValue < minFunctionValue) {
minFunctionValue = currentFunctionValue;
}
}
System.out.println(minFunctionValue);
}
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int M = scanner.nextInt();
int[] A = new int[N];
for (int i = 0; i < N; i++) {
A[i] = scanner.nextInt();
}
Arrays.sort(A);
int minFunctionValue = Integer.MAX_VALUE;
for (int i = 0; i <= N - M; i++) {
int currentFunctionValue = A[i + M - 1] - A[i];
if (currentFunctionValue < minFunctionValue) {
minFunctionValue = currentFunctionValue;
}
}
System.out.println(minFunctionValue);
}
}
๐34โค3