ricardolira48
BAN USER
Comments (4)
Reputation 95
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
8
of 10 vote
Optimal solutions is to multiply each weight by the amount of nodes to the left times the amount of nodes to the right, so for:
E F
4 \ / 5
A
1 |
B
2 / \ 3
C D
Answer is 1*3*3 + 2*1*5 + 3*1*5 + 4*1*5 + 5*1*5 = 79
Comment hidden because of low score. Click to expand.
-1
of 1 vote
public static int F12(){
int num = F6();
if(F6() > 3){
return num*2;
}
return num;
}
Comment hidden because of low score. Click to expand.
-1
of 1 vote
replace last 2 digits
- ricardolira48 August 02, 2016Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Sort both arrays, now get 2 pointers l2 and l1, one at the beginning of the second array and one at the end of the first array. For each iteration if l1+l2 > target then decrease l1, else increase l2, if l1+l2=target return l1 and l2, return false if l1 reaches the beginning of the first array and l2 reaches the end of the second array.
- ricardolira48 September 04, 2016