Accurate clustering of IoT devices is a promising challenge. We have observed that a few studies have been performed to address this challenge. However, they are expensive or do not shape accurate clustering. To fill this gap, in this study, we first solve a geometric version of a big challenge in pure mathematics: the NP-hard "Almost [Formula: see text]" problem. Then, we solve it in a polynomial time. To clarify the concept, we present it as the "Two Disjoint Convex Hulls" challenge. We solve this challenge using two algorithms: the first is "Naive" and the second is faster than the "Naive" one can solve it in polynomial order, [Formula: see text]. In addition to providing a mathematical proof of our solution, we demonstrate its superior performance within an IoT industrial ecosystem.