diff --git a/00-chartgpt/chainlit/test_app.py b/00-chartgpt/chainlit/test_app.py index 72f2d18d263f7d8bf22ed848f6c6bc411e979a8e..1b309d8a8cc0797404a03585569818a00e7c8196 100644 --- a/00-chartgpt/chainlit/test_app.py +++ b/00-chartgpt/chainlit/test_app.py @@ -1,9 +1,8 @@ import openai import chainlit as cl -openai.proxy = 'http://127.0.0.1:7890' +openai.proxy = 'http://127.0.0.1:8088' openai.api_key = "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" -# model_name = "text-davinci-003" model_name = "gpt-3.5-turbo" settings = { "temperature": 0.7, diff --git "a/14_\345\210\267\351\242\230/day03/problem_solving_21.py" "b/14_\345\210\267\351\242\230/day03/problem_solving_21.py" new file mode 100644 index 0000000000000000000000000000000000000000..189cc0422c4dfb3c0fd9a349d00ffd3d9a604f2b --- /dev/null +++ "b/14_\345\210\267\351\242\230/day03/problem_solving_21.py" @@ -0,0 +1,22 @@ +""" +第三大的数 +""" +from typing import List + + +class Solution: + def thirdMax(self, nums: List[int]) -> int: + if not nums: + return None + if len(nums) < 3: + return max(nums) + nums = sorted(set(nums), reverse=True) + if len(nums) >= 3: + return nums[2] + else: + return max(nums) + + +if __name__ == '__main__': + result = Solution().thirdMax([3, 2, 1]) + print(result)