본문 바로가기

Python36

Python 프로젝트 Heroku deploy 시 Determining which buildpack to use for this appremote: ! No default language could be detected for this app에 python + django 프로젝트를 Heroku에 deploy하려는 데 계속 No default language could be detected for this app 에러가 났다...! 이 때의 해결 방법은 1. 루트 폴더에 requirements.txt가 있는 지 확인. 없으면 $ pip freeze > requirements.txt 로 생성. 2. 루트 폴더에 runtime.txt가 있는 지 확인. 없으면 만들고, 안에는 python-3.8.10 과 같이 나의 python 버전을 써준다. 나의 python 버전이 궁금하면 $ ##_env/Scripts/activate (윈도우 기준, 가상 환경 실행) >>> python --version 하면 확인할 수 있다. 하지만!!! 나의 경우 몇 번을 확.. 2021. 6. 7.
[코딩 테스트] 리트코드70 - Climbing Stairs (Easy) in Python You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? n 개의 계단을 올라야 목적지에 다다를 수 있다. 한 번에 1개, 혹은 2개 계단씩 오를 수 있다면, 얼마나 다양한 방법으로 목적지에 갈 수 있을까? 예시 Input: n = 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 step + 1 step 2. 2 steps Constraints 1 >>>>>> 파이썬 1초 평균 연산 1억 따라서 Me.. 2021. 6. 1.
[코딩 테스트] 리트코드 208 - Implement Trie(Prefix Tree) A trie (pronounced as "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker. Implement the Trie class: 트라이 구조를 문제에서 요구하는 대로 구현하세요. Trie() Initializes the trie object. void insert(String word) Inserts the string word into the trie. boolean sear.. 2021. 5. 31.
[자료구조] Trie in Python 파이썬으로 구현하는 Trie. 출처 - https://www.youtube.com/watch?v=o6563NNbdtg Trie의 필요성 어떠한 사전이 내가 찾는 문자열을 담고 있는 지 알아본다고 하자. 사전이 담고 있는 문자열들 - "leets", "leeds", "leet" 내가 찾고자 하는 문자열 - "leet" 사전을 구성하는 방법엔 여러 가지가 있을 것이다. 예를 들어, hash table을 사용해, 각 문자열을 해싱해 얻은 키 값에 True 값을 지정해주면 Key Value leets True leeds True leet True 와 같이 될 것이고, 내가 찾는 문자열 leet이 사전에 있는가는 if "leet" in hashTable and hashTable["leet"] 의 Value가 Tr.. 2021. 5. 31.