Question: I asked [this question](https://math.stackexchange.com/q/3252981/660) on Mathematics Stackexchange, but got no answer.

Let $\mathcal A$ and $\mathcal B$ be nonempty categories whose categories $\mathcal A^{\mathcal A}$ and $\mathcal B^{\mathcal B}$ of endofunctors are equivalent. 

> 
> Are $\mathcal A$ and $\mathcal B$ necessarily equivalent?
> 
> 
> 

Implicit assumption: we are working in ZFC, and we assume that ZFC is consistent.

If my understanding is correct, [this post](https://mathoverflow.net/a/6594/461) of Joel David Hamkins implies that one cannot prove that the answer is Yes, so that either the answer is No, or the question is undecidable. (I think that the answer is No.)

[Reminder 1: Categories are generalized sets in the following sense. Given a set $S$ let $\mathcal C(S)$ be the category whose objects are the elements of $S$ and whose only morphisms are the identity morphisms. Then the assignment $S\mapsto\mathcal C(S)$ commutes with exponentials in the obvious sense.]

[Reminder 2: Infinite cardinals $\kappa$ satisfy $\kappa^\kappa=2^\kappa$. Indeed $\kappa^\kappa\le(2^\kappa)^\kappa=2^{\kappa\kappa}=2^\kappa\le\kappa^\kappa$.]

Answer: 
(Edited to reflect your edit to the question!)

The answer to your original statement (without the "nonempty" assumption) is no because we can let $A=\varnothing$ and $B=\ast$. Their endofunctor categories are each discrete with one object, but the categories themselves are not equivalent.

The question becomes a lot trickier when you add "nonempty" to the statement, but I think the answer is still no. I believe the following is a counterexample:

Let $G$ be an abelian group such that $G\times G\cong G$ and $\text{End}(G)$ is infinite. (So, for example, let $G=\Pi\_{n\geq 1} \mathbb{Z}$). Let $C$ be the one object category corresponding to $G$. Notice that $C$ is not equivalent to $C\sqcup C$ because $C$ has just one object and $C\sqcup C$ has two non-isomorphic objects. But let's compare their endofunctor categories.

First, let's describe $C^C$. The objects in $C^C$ are precisely the homomorphisms $G\rightarrow G$. Each morphism in $C^C$, i.e., each natural transformation $\phi\Rightarrow \psi$, is a choice of $g\in G$ such that $g\phi(h)=\psi(h)g$ for all $h$, but since $G$ is abelian, that means $\phi=\psi$. Thus, $C^C\cong \sqcup\_{\text{End}(G)} C$. Now, observe that $(C\sqcup C)^C\cong C^C \sqcup C^C$ since $C$ has one object. Putting these together and using the fact that $C^{(-)}$ sends colimits to limits, we have

$(C\sqcup C)^{C\sqcup C}\cong (C\sqcup C)^C\times (C\sqcup C)^C \cong (C^C \sqcup C^C)\times (C^C\sqcup C^C)\cong C^C \times C^C$,

where the last isomorphism comes from $C^C$ being an infinite coproduct. But then

$C^C\times C^C \cong (\sqcup\_{\text{End}(G)} C) \times (\sqcup\_{\text{End}(G)} C)\cong \sqcup\_{\text{End}(G)\times \text{End}(G)} (C\times C)\cong \sqcup\_{\text{End}(G)} C\cong C^C$

(Note: In this example, the endofunctor categories are in fact *isomorphic*, not just equivalent.)
Here is another counterexample, also using groupoids. 

For a group $G$ I will use the notation $G$ also for the corresponding one-object groupoid. If $C$ is the disjoint union of groups $G\_i$ and $D$ is the disjoint union of groups $H\_j$ then $C^D$ is the product over $j$ of the disjoint union over $i$ of the groupoid $G\_i^{H\_j}$. If $G$ is an abelian group then $G^H$ is the disjoint union, over all homomorphisms $H\to G$, of $G$.

Putting all of this together, one can work out a description of $A^A$ when the groupoid $A=\infty 1\coprod \infty\mathbb Z$ is the disjoint union of countably infinitely many trivial groups and countably infinitely many infinite cyclic groups. It comes out be the disjoint union of the following groups, each occurring a continuum's worth of times: free abelian groups of all finite ranks, and a countably infinite product of $\mathbb Z$'s.

Now let $B=\infty 1\coprod \infty\mathbb Z\coprod \mathbb Z^2$ be the disjoint union of $A$ with one copy of $\mathbb Z^2$. Then $B^B$ comes out to be isomorphic to $A^A$.