If a user has write and execute permissions on a directory, they can delete any file or directory therein, regardless of the ownerships of those. It is so because the deletion of a file or subdirectory from a directory is a modification to the directory, not to the thing being deleted.
Example: I create a directory owned by root in a directory that I own, then delete it.
$ sudo mkdir directory
$ ls -l
total 4
drwxr-xr-x 2 root wheel 512 Nov 25 11:11 directory
$ rmdir directory
$ ls -l
(no output)
Now, if the subdirectory contains files, then the permissions on that directory becomes more interesting:
$ sudo mkdir directory
$ sudo touch directory/file
$ rm -rf directory
rm: directory/file: Permission denied
rm: directory: Directory not empty
Here, I can't delete the subdirectory because I have no permissions to delete the file that is inside it.
But you say that the permissions are set to 777, which means anyone could delete the files inside it:
$ sudo chmod 777 directory
$ rm -rf directory
(no error)
Another user on my system would still not be able to do this, because they have no write permissions in the directory where I'm working, although they could still delete the contents of the root-owned subdirectory, if that directory was accessible to them (the users would need execute permissions on the directory and all parent directories).
777permissions?dir, and has write permissions in it, they would be able to delete files in it that belongs to other users.