From cbdb8c919820d13bd27c8e21964c82bf62bfbac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E8=8B=B1=E6=9D=B0?= <327782001@qq.com> Date: Thu, 22 Jun 2023 08:29:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=A7=BB=E9=99=A4=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 00-chartgpt/chainlit/nohup.out | 4 ++++ .../problem_solving_03.py" | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 "14_\345\210\267\351\242\230/problem_solving_03.py" diff --git a/00-chartgpt/chainlit/nohup.out b/00-chartgpt/chainlit/nohup.out index 18f97e2..a0b66cc 100644 --- a/00-chartgpt/chainlit/nohup.out +++ b/00-chartgpt/chainlit/nohup.out @@ -2,3 +2,7 @@ engine was transferred to model_kwargs. Please confirm that engine is what you intended. 2023-06-21 21:24:02 - Your app is available at http://localhost:8000 +2023-06-21 22:32:31 - WARNING! engine is not default parameter. + engine was transferred to model_kwargs. + Please confirm that engine is what you intended. +2023-06-21 22:32:31 - Your app is available at http://localhost:8000 diff --git "a/14_\345\210\267\351\242\230/problem_solving_03.py" "b/14_\345\210\267\351\242\230/problem_solving_03.py" new file mode 100644 index 0000000..5dc2b12 --- /dev/null +++ "b/14_\345\210\267\351\242\230/problem_solving_03.py" @@ -0,0 +1,19 @@ +""" +移除元素 +""" +from typing import List + + +class Solution: + def removeElement(self, nums: List[int], val: int) -> int: + left = 0 + for index in range(0, len(nums)): + if nums[index] != val: + nums[left] = nums[index] + left += 1 + return left + + +if __name__ == '__main__': + result = Solution().removeElement([2], 3) + print(result) -- GitLab