In wireless sensor network, since each sensor is equipped with a limited power, efficient use of the energy is important. One possible network management scheme is to cluster the sensors into several sets, so that the sensors in each of the sets can completely perform the monitoring task. Then the sensors in one set become active to perform the monitoring task and the rest of the sensors switch to a sleep state to save energy. Therefore, we rotate the roles of the active set among the sensors to max-imize the network lifetime. In this paper, we suggest an optimal algorithm for the maximum lifetime coverage problem which maximizes the network lifetime. For comparison, we implemented both the heuristic proposed earlier and our algorithm, and executed computational experiments. Our algorithm outperformed the heuristic concerning the obtained network lifetimes, and it found the solutions in a reasonable amount of time.