Instead of looking for a common friend of A and B, look for someone who has friends A and B.
if you are using relational DB, use count() didn't quite understand your first part that "only if A is friend of B". i assume when A is a friend of B, B is a friend of A as well On Mar 24, 6:43 am, snehal jain <learner....@gmail.com> wrote: > Suppose there are 2 persons A and B on FB . A should be able to view > the pictures of B only if either A is friend of B or A and B have at > least one common friend . -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.