Warning: Deleting directories is never a good idea. It can render some package managers broken or software in a extremely difficult to recover half-installed state!
Best always to first uninstall the way you installed it. And after having successfully removed it the correct way, you can start deleting any left-over configuration files.
Some likely ways to check for installations and how to remove (if the installation is ultimate edition):
snap
snap list | grep -i intellij
sudo snap remove intellij-idea-ultimate
flatpak
flatpak list --app | grep -i intellij
sudo flatpak uninstall com.jetbrains.IntelliJ-IDEA-Ultimate
apt
apt list --installed | grep -i intellij
sudo apt purge intellij-idea-ultimate
Intellij idea? The best way to uninstall it is to reverse the install process. – waltinator Aug 06 '18 at 22:21