I have taken different node values only .
a[1]=1;
a[2]=3;
a[3]=2;
a[4]=5.
Duhhh.
I have taken different node values only .
a[1]=1;
a[2]=3;
a[3]=2;
a[4]=5.
Duhhh.
You need to check one thing more that those nodes which have non zero and should have an edge, in ur case 1 3 5 create a cycle.
Thanks bruh. Got it.
They seem to be saying in the problem that we have to add edges on our own. Very less did I know that edges will automatically be created for all pair of nodes whose (xAndy>0)
Guys Is their any update on results of this challenge?
same here
no
They were supposed to announce the result on 6th october, morning but not still declared
If any one got selected then please share with us atleast we will get to know when they have announced the result
did anyone get this question : maximum product?
It seemed very easy, simple greedy question, but all the test cases were failing except the sample ones
I’m attaching the ss, please help, i want to upsolve it.
I think here also girls got simple problems lol
MAXIMUM PRODUCT
sort the array B
for every index starting from 0 to n-1 in array B, choose a minimum element in array A
and replace it with either a[i]=max(a[i]*b[j],a[i]+b[j]) if the choosen index is index i in array A.
repeat this for all element in array B
finally take the product of resultant array form;
for finding minimum element in array A , use min heap
You can just sort array A and array B , and do ,
A[i]=max(A[i]+B[i],A[i]*B[i])
This will give the same answer as yours. Also, remember for each A-element, only 1-Belement can be assigned to it. And those 2 elements, once chosen can never be selected again.
And guess what? This approach gives WA. I had this problem in my set .
After some deep observation, I reached the right solution and got AC.
I know right ? Simple greedy just fails. Happened to me as well.
Finally got AC though. I would rate it as a hard problem and add its solution soon.
Length of string B is always “2” and its consists of 2 different characters.
Say A="abcdebdfevb" and B="ae" , now write A with spaces(without a and e) :
Here : (0b0c0d0b0d0f0v0b0)
Number of arrangements of remaining letters : y=8!/(3!.2!) , now, remaining 9 places can be filled by 2 characters(a and e) in
:
(9C2).2! ways ,
so final answer is : (9C2*2!)*(8!/(2!*3!))
Hope you got the idea!!
thanks…waiting for your solution.
you guys managed to click SS …XD
I understood your approach but in the first line you said that length of B is always 2, how can you be sure on that statement? I mean they did not mention anything about it
Did you solve it if so share logic here
It was very clearly mentioned in the constraints of the problem. Seems like you didn’t check the constraints.