efficient diamond problem