private ArrayList<Integer> mergeSortedLists(ArrayList<Integer> first, ArrayList<Integer> second) {
        ArrayList<Integer> ret = new ArrayList<>();

        int fstIdx = 0;
        int sndIdx = 0;

        while (fstIdx < first.size() && sndIdx < second.size()) {
            if (first.get(fstIdx) < second.get(sndIdx)) {
                do {
                    ret.add(first.get(fstIdx));

                    ++fstIdx;
                    if (fstIdx >= first.size()) {
                        break;
                    }
                } while (first.get(fstIdx) < second.get(sndIdx));
            } else {
                do {
                    ret.add(second.get(sndIdx));

                    ++sndIdx;
                    if (sndIdx >= second.size()) {
                        break;
                    }
                } while (first.get(fstIdx) > second.get(sndIdx));
            }
        }

        while (fstIdx < first.size()) {
            ret.add(first.get(fstIdx));
            ++fstIdx;
        }
        while (sndIdx < second.size()) {
            ret.add(second.get(sndIdx));
            ++sndIdx;
        }

        return ret;
    }