There are no efficient algorithms for many computer science problems. The simplest approach is to try all possible (or many) solutions until the desired outcome is reached. This is called Brute Force Method.