I need to place N rects on a 2-dimensional grid with constraints.
For the each rect height/width and placing limitations($x_{min}$-$x_{max}$) are known.
The problem is to place all rects on a grid with no intersections that every rect's bottom left $x$ is in rect's $x_{min}$-$x_{max}$.
I've implemented the naive solution where I just iterating over rects and incrementing $x$ by some fixed step while checking for intersections. If no place found then I increment $y$ and iterate again.
The question: I'm sure that there are algorithms/data structures that will help me to solve this task faster, but I do not know where to start.