본문 바로가기

파이썬14

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.
[코딩 테스트] 리트코드207 -Course Schedule (Medium) in Python There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai. For example, the pair [0, 1], indicates that to take course 0 you have to first take course 1. Return true if you can finish all courses. Otherwise, return fal.. 2021. 6. 2.
[코딩 테스트] 리트코드139 -Word Break (Medium) in Python Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same word in the dictionary may be reused multiple times in the segmentation 문자열 s와 문자열들의 집합 wordDict가 주어졌을 때, wordDict안의 단어로 s를 만들 수 있는 지 확인! 예시: Input: s = "leetcode", wordDict = ["leet","code"] Output: true Explanation: Return .. 2021. 6. 1.
[자료구조] 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.