<jupyter_start><jupyter_text>2020년 9월 16일 수요일 leetCode - Sort Integers by The Number of 1 Bits (Python) 문제 : https://leetcode.com/problems/sort-integers-by-the-number-of-1-bits/ 블로그 : https://somjang.tistory.com/entry/leetCode-1356-Sort-Integers-by-The-Number-of-1-Bits-Python  첫번째 시도<jupyter_code>class Solution:
    def sortByBits(self, arr: List[int]) -> List[int]:
        one_count_dict = {}
        for i, num in enumerate(arr):
            one_count = bin(num).count("1")
        
            one_count_dict[i] = one_count
            
        sorted_dict = sorted(one_count_dict.items(), key=lambda x:(x[1], arr[x[0]]))
        
        answer = [arr[num[0]] for num in sorted_dict]
        
        return answer<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13448735019973368, 'fraction_numerical': 0.023968042609853527, 'mean_word_length': 2.7412935323383083, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '393159', 'license': 'MIT', 'n_tokens_mistral': 295, 'n_tokens_neox': 294, 'n_words': 49, 'path': 'DAY 201 ~ 300/DAY210_[leetCode] Sort Integers by The Number of 1 Bits (Python).ipynb', 'repo_name': 'SOMJANG/CODINGTEST_PRACTICE', 'size': '751'}