def removeElement(self, nums, val):
while val in nums:
Wow, the test cases are weak. They should include something like this:
nums =  * 5000 +  * 5000
val = 1
Takes over 2 seconds on my PC (a fast solution I have takes about 0.002 seconds for it).
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.