Is there a way, ideally using higher order functions, to filter out the repeating substring elements in an array? For example:
var obj = ["a", "a.b.c", "a.b", "a.e", "a.b.d"]
to become
["a.b.c", "a.e", "a.b.d"] //since both "a" and "a.b" appear inside either "a.b.c" or "a.b.d".
The solution will probably require Hashtables or Sets but I am not sure how to get started.