i'm trying come algorithm following problem : i've got collection of triplets of integers - let's call these integers a, b, c. value stored inside can big, it's impossible create array of size a, b, or c. goal minimize size of collection. this, we're provided simple rule allows merge triplets : for 2 triplets (a, b, c) , (a', b', c'), remove original triplets , place triplet (a | a', b, c) if b == b' , c = c', | bitwise or. similar rules hold b , c also. in other words, if 2 values of 2 triplets equal, remove these 2 triplets, bitwise or third values , place result collection. the greedy approach misleading in similar cases , problem, can't find simple counterexample that'd lead correct solution. list 250 items correct solution 14, average size computed greedy merging 30 (varies 20 70). sub-optimal overhead gets bigger list size increases. i've tried playing around set bit counts, i've found no meaningful resul...