Can Legendary Actions be used after a dead creature’s turn?


If a monster has Legendary Actions, can it use one at the end of a dead creature’s turn? And would it matter if the dead creature is an ally of the monster or a PC?

Relevant section from the Monster Manual:

A legendary creature can take a certain number of special actions — called legendary actions — outside its turn. Only one legendary action option can be used at a time and only at the end of another creature’s turn. A legendary creature regains spent legendary actions at the start of its turn. It can forgo using them, and it can’t use them while incapacitated or otherwise unable to take actions. If surprised, it can’t use them until after its first turn in the combat.