@@ -0,0 +1,1173 @@
+#Too many mistakes were made.%0A#0. should use while loop instead of for.%0A#1. messed up with index. maybe with the sleepy head at 3pm%0Aclass Solution:%0A    # @param a list of integers%0A    # @return an integer%0A    def removeDuplicates(self, A):%0A        result = len(A)%0A        if result == 0:%0A            return result%0A%0A        curr = 0%0A        next_index = 1%0A        start_index = 1%0A        if next_index %3C len(A) and A%5Bnext_index%5D == A%5Bcurr%5D:%0A            next_index += 1%0A            start_index += 1%0A%0A        i = start_index%0A        while i %3C len(A):%0A            if A%5Bi%5D %3E A%5Bcurr%5D:%0A                temp = A%5Bnext_index%5D%0A                A%5Bnext_index%5D = A%5Bi%5D%0A                A%5Bi%5D = temp%0A                curr = next_index%0A                next_index += 1%0A                if (i + 1) %3C len(A) and A%5Bi+1%5D == A%5Bcurr%5D:%0A                    A%5Bnext_index%5D = A%5Bi+1%5D%0A                    next_index += 1%0A                    i += 1%0A            else:%0A                result -= 1%0A            i += 1%0A            print A%0A%0A        return result%0A%0Aif __name__ == %22__main__%22:%0A    solution = Solution()%0A    A = %5B1, 1, 1, 1, 2, 2, 2, 2, 3%5D%0A    result = solution.removeDuplicates(A)%0A    print A%5B:result%5D%0A

Remove Duplicates From Sorted Array II