<jupyter_start><jupyter_text>2020년 8월 11일 화요일 leetCode - Best Time to Buy and Sell Stock (Python) 문제 : https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ 블로그 : https://somjang.tistory.com/entry/leetCode-121-Best-Time-to-Buy-and-Sell-Stock-Python  첫번째 시도<jupyter_code>import heapq

class Solution:
    def maxProfit(self, prices: List[int]) -> int:
        if len(prices) < 2:
            return 0
        
        my_heapq = []
        
        profit = 0
        
        for price in prices:
            heapq.heappush(my_heapq, price)
            if price - my_heapq[0] > profit:
                profit = price - my_heapq[0]
                
        return profit<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10734463276836158, 'fraction_numerical': 0.0211864406779661, 'mean_word_length': 2.0042372881355934, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '265465', 'license': 'MIT', 'n_tokens_mistral': 274, 'n_tokens_neox': 270, 'n_words': 50, 'path': 'DAY 101 ~ 200/DAY187_[leetCode] Best Time to Buy and Sell Stock (Python).ipynb', 'repo_name': 'SOMJANG/CODINGTEST_PRACTICE', 'size': '708'}