離散空間の検索で部分集合を数える

またアルゴリズムの問題を挑戦しました。今回は四角の中に入れる点をサブセットにしてユーザーが決める点の配列の中に部分集合の数を計算しなければいけません。対象になる空間はデカルト座標系と呼ばれる二次元の空間です。
The problem is: given a side length n and a set of points (in the form of two integer arrays for the x and y coordinates) compute the number of distinct subsets which can be contained in an nxn square.
My solution involved moving a square through the space of points, beginning below and two the left of all of them. It consisted of two primary methods: getNext, which finds the next point to either add to a subset in a square or remove from a subset in a square, and adjustCurr, which sets the lower left corner of the square based on the point added or removed. On each move of the square, the minimal distance which will induce a change in subsets is computed. By moving first vertically, then horizontally to the end of a "row", then resetting and moving vertically again, all possible enclosures can be found. When a point is moved onto, the right edge of the square touches it. When it is moved off of, either the left or bottom edge of the square is separated from it by 1/2. The complexity ofthe solution is O(50*100), as each point can be moved onto and off of once, all points may be checked to find the next move, and there are 50 points.