Let $K=K_1\cup\dots\cup K_n$ and $K_i$ are convex. Consider the [nerve][1] $N$ of your covering $K_i$. Note that $N$ is homotopically equivalent to $K$. (To find $N$ you only need an algorithm which decides that given subcollection of $K_i$ has nonempty intersection.) Calculate the homology groups of $N$ and you may get a "no" answer if you are (un)lucky. [1]: http://en.wikipedia.org/wiki/Nerve_of_a_covering