code: public int[] add(int[] p, int[] q) {
      int len = Math.max(p.length, q.length);
      int[] result = new int[len];
      for (int i = 0; i < len; i++) {
        if (i < p.length && i < q.length) {
          result[i] = add(p[i], q[i]);
        } else if (i < p.length) {
          result[i] = p[i];
        } else {
          result[i] = q[i];
        }
      }
      return result;
    }
docs: Compute the sum of two polynomials. The index in the
  array corresponds to the power of the entry. For example p[0] is the
  constant term of the polynomial p.
  @param p input polynomial
  @param q input polynomial
  @return polynomial represents p+q