We study the behavior of self-avoiding walks (SAWs) on square and cubic lattices in the presence of strong disorder. We simulate the disorder by assigning random energy epsilon taken from a probability distribution P(epsilon) to each site (or bond) of the lattice. We study the strong disorder limit for an extremely broad range of energies with P(epsilon) is proportional to 1/epsilon. For each configuration of disorder, we find by exact enumeration the optimal SAW of fixed length N and fixed origin that minimizes the sum of the energies of the visited sites (or bonds). We find the fractal dimension of the optimal path to be d(opt)=1.52+/-0.10 in two dimensions (2D) and d(opt)=1.82+/-0.08 in 3D. Our results imply that SAWs in strong disorder with fixed N are much more compact than SAWs in disordered media with a uniform distribution of energies, optimal paths in strong disorder with fixed end-to-end distance R, and SAWs on a percolation cluster. Our results are also consistent with the possibility that SAWs in strong disorder belong to the same universality class as the maximal SAW on a percolation cluster at criticality, for which we calculate the fractal dimension d(max)=1.64+/-0.02 for 2D and d(max)=1.87+/-0.05 for 3D, values very close to the fractal dimensions of the percolation backbone in 2D and 3D.