# How to find the class of a problem?

I've learnt about complexity classes but my knowledge doesn't seem to help much when I am given a problem and need to decide it's complexity.

Here is the problem at hand: A set of weights with the same dimensions but with different densities have to be ordered on a plank (on a straight line). The length of the plank is not enough to put everything in one line so you'd have to stack weights on top of each other. There are $n$ weights and there's space only for $m$, $m<n$ weights on the plank. The weight of each object is given.

The target is to stack weights such that the weights are spread across the plank as smoothly as possible. The following figure shows a sample (possible) solution for n=11 weights each having weight w1 to w11 and m=5.

The smoothness of the weight distribution is calculated by finding the average of all weights and summing up the deviation from this value at each spot.

Now definitely this is a combinatorial problem. And it is definitely a 'yes' 'no' answerable problem.

It seems to me that it's not in NP. Because given a solution, there is no way of saying in polynomial time that it's the correct answer. Is this right?

If so, does that mean it is in NP hard?

How can I really find which class it belongs to.

I'd appreciate it if anybody could help me with this problem.

You have described an optimization problem, namely, find the arrangement that minimizes the average deviation from the mean. The decision version of this problem is, given an input to your problem and a value $T$, whether there exists an arrangement whose average deviation is at most $T$. This problem is in NP.