Microsoft & Meta Interview Problem

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Ah yes another sahil video where i understand nothing 😅

aagreg
Автор

For each element of the array, multiply all the numbers left to it and right to it and store it in result array.

saurabh
Автор

Just now I solved this problem in clg and opened YT to relax😅but this prblm followed to my YT😂

digitalvidya
Автор

What type of question is this 😅 ? The hint is there in the question itself "product of prefix and postfix, solution is have pre and post two array and ans[i] = pre[i-1] * post[i + 1], in general saying there would be edge cases I know

allmighty
Автор

This will work only if there are no zeros

vinaypinjala
Автор

"You are not allowed to use division." Are you allowed to multiply by rationals? Why not just eliminate arithmetic altogether?Truly, these interviews are idiotic.

davea
Автор

cant you just loop through it and do a condition if (nums[i] != i), then do what you gotta do? (i am a beginner)

yourwelcome
Автор

I was able to figure out the approach 🥳
But not the actual code may be 🙂

rockygaming
Автор

you use the prefixn, postfixn = 1, 1 method where you loop through the array once forward and then another time backward

njlulde
Автор

Calculate the product of all and divide by n(i) at each iteration

-MahindraRaj
Автор

this solution has high space complexity

priyanshubari
Автор

And the follow up question solve it with one array not including originally array and yes you could that just make variable and keep the second loop and just multi play with accumulative multi from the right my question is what happens if i said i will use shift right and say didn't use multiplay

ahmedamr
Автор

You are talking about prefix and suffix array, right ??

saumyaramani
Автор

Hey sir I want to learn Python and MySQL, give me course playlist or make a video on it ....🙃

jjnayak
Автор

it is easy for me . but I am not good in algorithms . can you tell me how to a learn data structures and algorithms

aswinibotla
Автор

There is a better solution using bit manipulation which uses constant space and O(n) time

deepak
Автор

Sir can you make a short on back end development?

musicalnerd
Автор

problem by "Grag Hog" channel @ YouTube

IamMQaisar
Автор

I am not from CS background but this is how I managed to solve it.

# define array
array = [1, 2, 3, 4]

def productExceptSelf(nums):

## create a empty array to store products
products = []

for i in range(len(nums)):

product = 1

for j in range(len(nums)):

if i == j:

## isolate the number
continue

else:

## multilpy the nums
product *= nums[j]

## append the products in an array
products.append(product)

return products

answer = productExceptSelf(array)

print(answer)

balkrishankohli
Автор

I have a zero knowledge of any coding and programming language 😅

jjnayak