Can anyone give me some advice on making this long python code using for loops run faster? This is a code to find 3 integers in a list called "nums" that is closest to "target". This code totally works, but I might need a more efficient way.:
class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
clse = 2**31-1
for a in range(len(nums)):
for b in range(len(nums)):
for c in range(len(nums)):
if a is not b and b is not c and c is not a:
if abs(nums[a]+nums[b]+nums[c]-target) < clse:
print(a,b,c)
clse = abs(nums[a]+nums[b]+nums[c]-target)
anum = nums[a]+nums[b]+nums[c]
return anum