IBM Coding Exam Answers
https://www.youtube.com/shorts/tfmcOsVBW60
Like this Video and Subscribe this channel FAST
Which code you want?
Anonymous Poll
26%
9*9
57%
Greedy Virus
11%
Comment (if something else)
6%
NONE
Fencing Code
C++
TCS Codevita
https://t.me/TCS_Codevita_Exam_Help
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x, y, x1, y1, x2, y2;
cin >> x >> y >> x1 >> y1 >> x2 >> y2;
x = abs(x);
y = abs(y);
x1 = abs(x1);
y1 = abs(y1);
x2 = abs(x2);
y2 = abs(y2);
int r1 = sqrt(((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y)));
int r2 = sqrt(((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y)));
int a1 = M_PI * r1 * r1;
int a2 = M_PI * r2 * r2;
if (a2 > a1)
{
int e = a2 - a1;
int f = sqrt(e);
int g = f * f;
int h = g - e;
int i = h * 20;
cout << "Krishna " << i;
}
else if (a1 > a2)
{
int p = a1 - a2;
int q = p * 20;
cout << "Shiva " << q;
}
else if (a1 == a2)
{
cout << "-1";
}
return 0;
}
Fencing Code
C++
TCS Codevita
https://t.me/TCS_Codevita_Exam_Help
C++
TCS Codevita
https://t.me/TCS_Codevita_Exam_Help
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x, y, x1, y1, x2, y2;
cin >> x >> y >> x1 >> y1 >> x2 >> y2;
x = abs(x);
y = abs(y);
x1 = abs(x1);
y1 = abs(y1);
x2 = abs(x2);
y2 = abs(y2);
int r1 = sqrt(((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y)));
int r2 = sqrt(((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y)));
int a1 = M_PI * r1 * r1;
int a2 = M_PI * r2 * r2;
if (a2 > a1)
{
int e = a2 - a1;
int f = sqrt(e);
int g = f * f;
int h = g - e;
int i = h * 20;
cout << "Krishna " << i;
}
else if (a1 > a2)
{
int p = a1 - a2;
int q = p * 20;
cout << "Shiva " << q;
}
else if (a1 == a2)
{
cout << "-1";
}
return 0;
}
Fencing Code
C++
TCS Codevita
https://t.me/TCS_Codevita_Exam_Help
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x, y, x1, y1, x2, y2;
cin >> x >> y >> x1 >> y1 >> x2 >> y2;
x = abs(x);
y = abs(y);
x1 = abs(x1);
y1 = abs(y1);
x2 = abs(x2);
y2 = abs(y2);
int r1 = sqrt(((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y)));
int r2 = sqrt(((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y)));
int a1 = M_PI * r1 * r1;
int a2 = M_PI * r2 * r2;
if (a2 > a1)
{
int e = a2 - a1;
int f = sqrt(e);
int g = f * f;
int h = g - e;
int i = h * 20;
cout << "Krishna " << i;
}
else if (a1 > a2)
{
int p = a1 - a2;
int q = p * 20;
cout << "Shiva " << q;
}
else if (a1 == a2)
{
cout << "-1";
}
return 0;
}
Fencing Problem
Pls share
https://t.me/TCS_Codevita_Exam_Help
using namespace std;
int main()
{
int x, y, x1, y1, x2, y2;
cin >> x >> y >> x1 >> y1 >> x2 >> y2;
x = abs(x);
y = abs(y);
x1 = abs(x1);
y1 = abs(y1);
x2 = abs(x2);
y2 = abs(y2);
int r1 = sqrt(((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y)));
int r2 = sqrt(((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y)));
int a1 = M_PI * r1 * r1;
int a2 = M_PI * r2 * r2;
if (a2 > a1)
{
int e = a2 - a1;
int f = sqrt(e);
int g = f * f;
int h = g - e;
int i = h * 20;
cout << "Krishna " << i;
}
else if (a1 > a2)
{
int p = a1 - a2;
int q = p * 20;
cout << "Shiva " << q;
}
else if (a1 == a2)
{
cout << "-1";
}
return 0;
}
Fencing Problem
Pls share
https://t.me/TCS_Codevita_Exam_Help
Sports Day
Python
TCS Codevita
def ans(numbers):
numbers.sort()
n = len(numbers)
placementlelo = 0
for i in range(n):
efficiency = 0
priority = 1
for j in range(i, n):
efficiency += numbers[j] * priority
priority += 1
if efficiency > placementlelo:
placementlelo = efficiency
return placementlelo
numbers = list(map(int, input().split()))
result = ans(numbers)
if(result>0):
print(result, end="")
else:
print(0, end="")
Sports Day
Python
TCS Codevita
Pls share
https://t.me/TCS_Codevita_Exam_Help
Python
TCS Codevita
def ans(numbers):
numbers.sort()
n = len(numbers)
placementlelo = 0
for i in range(n):
efficiency = 0
priority = 1
for j in range(i, n):
efficiency += numbers[j] * priority
priority += 1
if efficiency > placementlelo:
placementlelo = efficiency
return placementlelo
numbers = list(map(int, input().split()))
result = ans(numbers)
if(result>0):
print(result, end="")
else:
print(0, end="")
Sports Day
Python
TCS Codevita
Pls share
https://t.me/TCS_Codevita_Exam_Help
SUBSCRIBE MORE.... SHARE THIS CHANNEL
NEXT UPCOMING CODES:
BUBBLE SORT
Password Generator
NEXT UPCOMING CODES:
BUBBLE SORT
Password Generator
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