You might have come across read, write and execute permission for a file. Similar to this, there is another permission called sticky bit. If a file is assigned with a sticky bit, then only that owner can delete that file even though other users have write permission.
You can assign sticky bit as follows:
$ chmod 1777 <filename>
Here, the digit 1 indicates the sticky bit
or you can assign it like this:
$ chmod +t <filename>