IBM Coding Exam Answers
2.45K subscribers
13 photos
70 links
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
OUR MAIN TELEGRAM CHANNEL FOR JOB OPPORTUNITIES FOR CS / IT JOBS

https://t.me/Coding_Placement_Guru/3
This media is not supported in your browser
VIEW IN TELEGRAM
PickUp Service
Python
100% Working
TCS Codevita


def pick_up_service(N, start, connections):
graph = defaultdict(list)
taxes = defaultdict(int)
for i in range(N - 1):
city1, city2, goods, tax = connections[i]
graph[city1].append((-1 * goods, tax, city2))
taxes[city2] = tax

route = []


def dfs(city):
route.append(city)
for n in sorted(graph[city]):
dfs(n[2])
route.append(city)
dfs(start)


total_tax = 0
for c in route[1:]:
total_tax += taxes[c]

return route, total_tax


N = int(input())
cons = []


for _ in range(N-1):
l = input()
ls = l.split()
cons.append((ls[0], ls[1], int(ls[2]), int(ls[3])))


ans, t = pick_up_service(N, cons[0][0], cons)

print("-".join(ans))
print(t, end="")

PickUp Service
Python
100% Working
TCS Codevita
This media is not supported in your browser
VIEW IN TELEGRAM
OUR MAIN TELEGRAM CHANNEL FOR JOB OPPORTUNITIES FOR CS / IT JOBS

https://t.me/Coding_Placement_Guru/3

JOIN FAST
WAREHOUSE PROB ANSWERS



def minimum_vehicles(weights, max_limit):
coding = sorted(filter(lambda x: x != 0, weights), reverse=True)


left, right = 0, len(coding) - 1
vehicles = 0

while left <= right:
if coding[left] + coding[right] <= max_limit:
right -= 1
left += 1
vehicles += 1

return vehicles

weights = list(map(int, input().split()))
max_limit = int(input())

result = minimum_vehicles(weights, max_limit)
print(result, end="")
_________CORRECT _______________________
Whittle Code

def calculate_area(nails):
x_coords = [nail[0] for nail in nails]
y_coords = [nail[1] for nail in nails]

min_x = min(x_coords)
max_x = max(x_coords)
min_y = min(y_coords)
max_y = max(y_coords)

return (max_x - min_x) * (max_y - min_y)

def pick_nails(nails, m):
result = []
while m > 0:
min_area = float('inf')
nail_to_remove = None

for i, nail in enumerate(nails):
remaining_nails = nails[:i] + nails[i + 1:]
current_area = calculate_area(remaining_nails)

if current_area < min_area:
min_area = current_area
nail_to_remove = nail

result.append(nail_to_remove)
nails.remove(nail_to_remove)
m -= 1

return result

def can_win_game(nails, m):
initial_area = calculate_area(nails)
picked_nails = pick_nails(nails.copy(), m)
final_area = calculate_area(picked_nails)

return final_area == 0, picked_nails

# Input the number of nails
N = int(input())

# Input coordinates of nails
nails = [list(map(int, input().split())) for _ in range(N)]

# Input the maximum number of nails a player can pick in their turn
m = int(input())

# Determine if the game can be won and print the result
can_win, picked_nails = can_win_game(nails, m)

for nail in picked_nails:
print(*nail)

print("YES" if can_win else "NO")
This media is not supported in your browser
VIEW IN TELEGRAM
t = int(input())
def toWord(n):
  if n == 1: return "one"
  elif n == 2: return "two"
  elif n == 3: return "thr"
  elif n == 4: return "fou"
  elif n == 5: return "fiv"
  elif n == 6: return "six"
  elif n == 7: return "sev"
  elif n == 8: return "eig"
  elif n == 9: return "nin"
  elif n == 0: return "zer"
 
def toSum(s):
  number = int(s)
  if number == 0: return 0
  elif number%9 == 0: return 9
  else: return number%9
for i in range(t):
  a = [x for x in input().split()]
  n = a[0]
  name = a[1]
  d1 = 0
  if "." in n:
    d1 = n.index('.')
  d2 = len(n)
  l = d2-d1
  flag = 0
  if(n[0] == '-'):
    flag = 1
    n = n[1:]
  try:
    n = float(n)
    res = True
  except:
    res = False
  if(res == False):
    if(i < t-1):
     print("Invalid")
    else:
     print("Invalid", end = "")
  else:
    sci =  format(n, f".{l}e")
    part = sci.split('e')
    num = part[0].split('.')
    k = int(part[1])
    if(flag == 1): res = "-"
    else: res = ""
    res += toWord(int(num[0])) +"."+toWord(toSum(num[1])) +"e"
    if(k > 0):
        res += '+'
    elif(k<0): res += '-'
    res += toWord(abs(int(part[1]))) +"@"
    if(k%2 != 0):
      for x in range(0,len(name),2):
        res += name[x]
    else:
      for x in range(1,len(name),2):
        res += name[x]
   
    if(i < t-1):
     print(res)
    else:
     print(res, end="")
Pswrd generator
This media is not supported in your browser
VIEW IN TELEGRAM
What is the next competition now?
Which year you are in?
Anonymous Poll
3%
1st
1%
2nd
20%
3rd
76%
4th
How placements are going in your college this year? Ho bhi rhe h kya?
This media is not supported in your browser
VIEW IN TELEGRAM
Company – Deloitte

Role – Analyst   

Qualification – Bachelor’s degree

Experience – Freshers/ Experienced

Location – Hyderabad

Apply Link :
https://usijobs.deloitte.com/careersUSI/JobDetail/USI-EH24-EA-AU-MCBD-Digital-Analyst/166885
OUR MAIN TELEGRAM CHANNEL FOR JOB OPPORTUNITIES FOR CS / IT JOBS

https://t.me/Coding_Placement_Guru/3

JOIN FAST
This media is not supported in your browser
VIEW IN TELEGRAM