Yo Yo Honey Singh
BAN USERBut I think that after step 3(removal of top bridge) and before going to step 2, we need to update the remaining bridges because some intersections would have already got resolved because of removal of top bridge and we need to to re-arrange bridges considering remaining intersection.
Please let me know if my understanding is correct.
In this code, don't you think the same cell's value has been considered twice(Once during row array and another during column array). I think that instead of "int val = rows[i] * col[j]", it should be
int val =(rows[i] * col[j])/arr[i][j]. Then in this case also we need to handle delived by zero scenario. Since we just bother for sign, instead of deviding, we can multiply arr[i][j].
Please let me know if my understanding is correct.
The complexity will remain O(n^2) in the worst case but in other cases I guess it can be improved by maintaining two separate arrays(one for rows and other for columns) for keeping track of which column or row has been already worked on(I mean made 0).
- Yo Yo Honey Singh February 08, 2014Suppose total population of all countries is P.
Population of countries are p1, p2, etc...
Now get
r1 = (p1*100/P) * X
r2 = (p2*100/P) * X
r3 = (p3*100/P) * X
r4 = (p4*100/P) * X
where x stands for random value. Greater the value of x, more accurate will be the answer.
Create an array and insert p1, r1 times. SImilarly do for p2, p3,etc.
Now randomize the array. And we will get the answer.
Repdalejohnson762, Accountant at ABC TECH SUPPORT
I have exceptionally skilled Journalists possessed dogged determination to find the new story and deliver it to the public. I ...
Since we are not allowed to create global or static variable, we can create hashmap(dictionary) datastructure, to maintain the key-value pair with key as nodevalue and value as sum of values of node greater than the node and while recurssive call, we will keep on sending this hashmap as an argument and using this hashmap, we will keep on updating the value.
- Yo Yo Honey Singh February 20, 2014Please let me know if this is right approach.