MAKE THE SUSBCRIBERS 500 and..
Don't Panic Everyone! Just Calm Down.. You have 6 Hours to complete those 6 Questions
Every Code will be uploaded.. But you have to share this Channel
SHARE THIS CHANNEL
Don't Panic Everyone! Just Calm Down.. You have 6 Hours to complete those 6 Questions
Every Code will be uploaded.. But you have to share this Channel
SHARE THIS CHANNEL
def minimum_vehicles(weights, max_limit):
# Filter out zero weights and sort the remaining weights in descending order
sorted_weights = sorted(filter(lambda x: x != 0, weights), reverse=True)
left, right = 0, len(sorted_weights) - 1
vehicles = 0
while left <= right:
if sorted_weights[left] + sorted_weights[right] <= max_limit:
right -= 1
left += 1
vehicles += 1
return vehicles
# Example usage:
weights = list(map(int, input().split()))
max_limit = int(input())
result = minimum_vehicles(weights, max_limit)
print(result,end="")
WareHouse Problem
Python
TCS Codevita
Pls share
https://t.me/TCS_Codevita_Exam_Help
# Filter out zero weights and sort the remaining weights in descending order
sorted_weights = sorted(filter(lambda x: x != 0, weights), reverse=True)
left, right = 0, len(sorted_weights) - 1
vehicles = 0
while left <= right:
if sorted_weights[left] + sorted_weights[right] <= max_limit:
right -= 1
left += 1
vehicles += 1
return vehicles
# Example usage:
weights = list(map(int, input().split()))
max_limit = int(input())
result = minimum_vehicles(weights, max_limit)
print(result,end="")
WareHouse Problem
Python
TCS Codevita
Pls share
https://t.me/TCS_Codevita_Exam_Help
def bubble_sort(a1, a2):
n = len(a1)
for i in range(n):
swapped = False
for j in range(0, n - i - 1):
if a1[j] > a1[j + 1]:
a1[j], a1[j + 1] = a1[j + 1], a1[j]
a2[j], a2[j + 1] = a2[j + 1], a2[j]
swapped = True
if not swapped:
break
return a2
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
result = bubble_sort(a1, a2)
print(*result)
Bubble sort
Python
TCS Codevita
Pls share
https://t.me/TCS_Codevita_Exam_Help
n = len(a1)
for i in range(n):
swapped = False
for j in range(0, n - i - 1):
if a1[j] > a1[j + 1]:
a1[j], a1[j + 1] = a1[j + 1], a1[j]
a2[j], a2[j + 1] = a2[j + 1], a2[j]
swapped = True
if not swapped:
break
return a2
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
result = bubble_sort(a1, a2)
print(*result)
Bubble sort
Python
TCS Codevita
Pls share
https://t.me/TCS_Codevita_Exam_Help
MAKE THE SUSBCRIBERS 1000 and..
Don't Panic Everyone! Just Calm Down.. You have 6 Hours to complete those 6 Questions
Every Code will be uploaded.. But you have to share this Channel
SHARE THIS CHANNEL
Don't Panic Everyone! Just Calm Down.. You have 6 Hours to complete those 6 Questions
Every Code will be uploaded.. But you have to share this Channel
SHARE THIS CHANNEL
#include <stdio.h>
void swap(int *xp, int *yp) {
int temp = *xp;
*xp = *yp;
*yp = temp;
}
void bubbleSort(int arr[], int n, int arr2[]) {
int i,j;
for (i = 0; i < n-1; i++) {
for (j = 0; j < n-i-1; j++) {
if (arr[j] > arr[j+1]) {
swap(&arr[j], &arr[j+1]);
swap(&arr2[j], &arr2[j+1]);
}
}
}
}
int main() {
int n,i,j;
printf("Enter size of arrays: ");
scanf("%d", &n);
int a1[n], a2[n];
printf("\nEnter first array: ");
for ( i = 0; i < n; i++) {
scanf("%d", &a1[i]);
}
printf("\nEnter second array: ");
for ( i = 0; i < n; i++) {
scanf("%d", &a2[i]);
}
bubbleSort(a1, n, a2);
for ( i = 0; i < n; i++) {
printf("%d ", a2[i]);
}
return 0;
}
Bubble Sort C++ Working Code
TCS Codevita
Pls share
https://t.me/TCS_Codevita_Exam_Help
void swap(int *xp, int *yp) {
int temp = *xp;
*xp = *yp;
*yp = temp;
}
void bubbleSort(int arr[], int n, int arr2[]) {
int i,j;
for (i = 0; i < n-1; i++) {
for (j = 0; j < n-i-1; j++) {
if (arr[j] > arr[j+1]) {
swap(&arr[j], &arr[j+1]);
swap(&arr2[j], &arr2[j+1]);
}
}
}
}
int main() {
int n,i,j;
printf("Enter size of arrays: ");
scanf("%d", &n);
int a1[n], a2[n];
printf("\nEnter first array: ");
for ( i = 0; i < n; i++) {
scanf("%d", &a1[i]);
}
printf("\nEnter second array: ");
for ( i = 0; i < n; i++) {
scanf("%d", &a2[i]);
}
bubbleSort(a1, n, a2);
for ( i = 0; i < n; i++) {
printf("%d ", a2[i]);
}
return 0;
}
Bubble Sort C++ Working Code
TCS Codevita
Pls share
https://t.me/TCS_Codevita_Exam_Help
IBM Coding Exam Answers
Bubble Sort Solution https://www.youtube.com/shorts/xcmj7hifWro
EVERYONE SUBSCRIBE THIS CHANNEL 🔥