일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- 데이콘
- AI 경진대회
- 자연어처리
- programmers
- 프로그래머스
- hackerrank
- ubuntu
- gs25
- Real or Not? NLP with Disaster Tweets
- 캐치카페
- 우분투
- Git
- PYTHON
- 백준
- 더현대서울 맛집
- github
- 코로나19
- dacon
- 편스토랑
- 편스토랑 우승상품
- leetcode
- 프로그래머스 파이썬
- ChatGPT
- Kaggle
- Docker
- 금융문자분석경진대회
- Baekjoon
- 파이썬
- SW Expert Academy
- 맥북
- Today
- Total
목록
반응형
2021/01 (33)
솜씨좋은장씨
Every non-negative integer N has a binary representation. For example, 5 can be represented as "101" in binary, 11 as "1011" in binary, and so on. Note that except for N = 0, there are no leading zeroes in any binary representation. The complement of a binary representation is the number in binary you get when changing every 1 to a 0 and 0 to a 1. For example, the complement of "101" in binary i..
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity. Example 1: Input: 1->2->3->4->5->NULL Output: 1->3->5->2->4->NULL Example 2: Input: 2->1->3->5->6->4->7->NULL Outpu..
Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain array if and only if: arr.length >= 3 There exists some i with 0 arr[i + 1] > ... > arr[arr.length - 1] Example 1: Input: arr = [2,1] Output: false Example 2: Input: arr = [3,5,5] Output: false ..
Given an integer n and an integer start. Define an array nums where nums[i] = start + 2*i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums. Example 1: Input: n = 5, start = 0 Output: 8 Explanation: Array nums is equal to [0, 2, 4, 6, 8] where (0 ^ 2 ^ 4 ^ 6 ^ 8) = 8. Where "^" corresponds to bitwise XOR operator. Example 2: Input: n = 4, start = 3 Output: 8 Explan..
Given a positive integer num, output its complement number. The complement strategy is to flip the bits of its binary representation. Example 1: Input: num = 5 Output: 2 Explanation: The binary representation of 5 is 101 (no leading zero bits), and its complement is 010. So you need to output 2. Example 2: Input: num = 1 Output: 0 Explanation: The binary representation of 1 is 1 (no leading zero..
Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible strings we could create. You can return the output in any order. Example 1: Input: S = "a1b2" Output: ["a1b2","a1B2","A1b2","A1B2"] Example 2: Input: S = "3z4" Output: ["3z4","3Z4"] Example 3: Input: S = "12345" Output: ["12345"] Example 4: Input: S = ..
Python과 elasticsearch 라이브러리를 통하여 nested 또는 object 형식으로 매핑되어 있는 필드에 인덱싱을 진행하려고 하는데 ValueError: Circular reference detected 위와 같은 오류가 계속 발생하여 이게...뭐지....? 매핑 형식이 잘 못 된 것인가... 고민을 했습니다. 구글을 검색하다보니 json 을 만들때 자기 자신 json을 다시 자기 자신에게 특정 키로 접근을 하려고 할 때 위와 같은 오류가 발생하는 것 같았습니다. 이렇게 알고 다시 코드를 확인해보니 position['bounding_box'] = position 인덱싱하려고 데이터를 만드는 반복문 안에서 자기 자신을 계속 자기 자신에게 넣으려고 하는 곳을 발견하였고 해당 부분을 수정하니 해..
OpenCV를 활용하여 이미지를 열고 특정 위치에 원과 사각형을 그린 후에 다시 저장하는 코드를 작성하였는데 error: (-215:Assertion failed) !_src.empty() 뭔가 cv2.imwrite를 통하여 저장하려고 하면 위와 같은 오류가 발생했습니다. 위의 오류가 발생하는 원인은 두 가지가 있습니다. 1. 잘못된 파일 경로 img = cv2.imread("{{ 파일 경로 }}") 첫 번째는 위와 같이 cv2.imread를 활용하여 파일을 불러올 때 입력한 파일 경로가 잘못 되어 입력한 파일 경로로 파일을 찾으려고 하여 오류가 발생하는 경우 입니다. 이를 해결하는 방법은 내가 불러오고자 하는 파일의 위치를 다시 확인하고 수정해주면 됩니다. 2. 파일 이름이 한글로 되어있는 경우 만약 ..
Given a positive integer num, write a function which returns True if num is a perfect square else False. Follow up: Do not use any built-in library function such as sqrt. Example 1: Input: num = 16 Output: true Example 2: Input: num = 14 Output: false Constraints: 1
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on. For convenience, the full table for the 26 letters of the English alphabet is given below: [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...
Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them in decreasing order. Return the sorted array. Example 1: Input: nums = [1,1,2,2,2,3] Output: [3,1,1,2,2,2] Explanation: '3' has a frequency of 1, '1' has a frequency of 2, and '2' has a frequency of 3. Example 2: Input: nums = [2,3,1,3,2]..
In English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word successor. For example, when the root "an" is followed by the successor word "other", we can form a new word "another". Given a dictionary consisting of many roots and a sentence consisting of words separated by spaces, replace all the successors in the sentence ..
Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length. Do not allocate extra space for another array; you must do this by modifying the input array in-place with O(1) extra memory. Clarification: Confused why the returned value is an integer, but your answer is an array? Note that the input array is passed in by reference,..
Given a sentence text (A sentence is a string of space-separated words) in the following format: First letter is in upper case. Each word in text are separated by a single space. Your task is to rearrange the words in text such that all words are rearranged in an increasing order of their lengths. If two words have the same length, arrange them in their original order. Return the new text follow..
서버에서 5000포트를 열어두고 Flask로 API 개발을 하면서 로그를 확인하던 중 193.169.252.54 - - [19/Jan/2021 06:53:15] code 400, message Bad HTTP/0.9 request type ('\x03\x00\x00/*à\x00\x00\x00\x00\x00Cookie:') 193.169.252.54 - - [19/Jan/2021 06:53:15] "/*àCookie: mstshash=Administr" HTTPStatus.BAD_REQUEST - 193.169.252.54 - - [19/Jan/2021 06:53:16] code 400, message Bad HTTP/0.9 request type ('\x03\x00\x00/*à\x00\x00\x00\x0..
You are given a string text of words that are placed among some number of spaces. Each word consists of one or more lowercase English letters and are separated by at least one space. It's guaranteed that text contains at least one word. Rearrange the spaces so that there is an equal number of spaces between every pair of adjacent words and that number is maximized. If you cannot redistribute all..
서버에 접속하기 위해서 $ ssh -i ~/somjang/server_keys/server_key.pem ubuntu@0.0.0.0 위와 같이 접속을 시도하였으나 아래와 같은 오류가 발생하게 되었습니다. The authenticity of host '0.0.0.0 (0.0.0.0)' can't be established. ECDSA key fingerprint is SHA256:sdfkjdlskdjflskdjflksjdflskdjlskfjsdlkf. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '0.0.0.0' (ECDSA) to the list of known hosts..
Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second middle node. Example 1: Input: [1,2,3,4,5] Output: Node 3 from this list (Serialization: [3,4,5]) The returned node has value 3. (The judge's serialization of this node is [3,4,5]). Note that we returned a ListNode object ans, such that: ans.val = 3, an..
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). Now given a string represented by several bits. Return whether the last character must be a one-bit character or not. The given string will always end with a zero. Example 1: Input: bits = [1, 0, 0] Output: True Explanation: The only way to decode i..
Given an array A of integers, for each integer A[i] we may choose any x with -K
Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the following cases holds: All letters in this word are capitals, like "USA". All letters in this word are not capitals, like "leetcode". Only the first letter in this word is capital, like "Google". Otherwise, we define that this word doesn't use..
최근 프로젝트를 진행하면서 개발하는 서버에 Elasticsearch를 설치해두고 편하게 사용하기 위하여 Elasticsearch의 9200 포트, Kibana의 5601 포트에 대해서 외부의 모든 접근을 허용하도록 인바운드 규칙을 설정해 두었었습니다. 설치를 하고 테스트로 제대로 동작하는지 인덱스를 생성해보고 더미 데이터를 인덱싱 해두었다가 이제 실제로 사용하려고 다시 Kibana를 켜서 인덱스 목록을 보았는데 ???????????????????????????????????????????? 테스트를 하면서 만들었던 인덱스는 사라져있고 그 자리에 인덱스 이름부터 날좀보소 하는 인덱스 하나만 남아 있었습니다. 뭐지? 하고 궁금해서 확인해보니 확인에 사용한 검색식 GET /read_me/_search { "q..
gunicorn을 활용하여 Flask로 만든 API를 배포하기 위하여 gunicorn --bind 0.0.0.0:5000 -w=2 -k=gevent --threads=2 app:app 위의 명령어를 활용하여 실행을 하니 [Ubuntu] ModuleNotFoundError: No module named '_bz2' 해결 방법 우분투에서 아래의 명령어를 통해 api를 gunicorn을 활용하여 띄우려고 할때 gunicorn --bind 0.0.0.0:5000 -w=2 -k=gevent --threads=2 app:app /usr/local/lib/python3.7/importlib/_bootstrap.py:219: Runtime.. somjang.tistory.com [Ubuntu] UserWarning: ..
Write a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to the node to be deleted directly. It is guaranteed that the node to be deleted is not a tail node in the list. Example 1: Input: head = [4,5,1,9], node = 5 Output: [4,1,9] Explanation: You are given the second node with value 5, the linked list shoul..
UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError. gunicorn을 사용하던 중 위와 같은 오류가 발생하게 되었습니다. 이를 해결 하는 방법은 다음과 같습니다. $ sudo apt-get install liblzma-dev apt-get install 명령어를 통하여 liblzma-dev를 설치해주면 됩니다. 그 다음 python을 한번 다시 컴파일 해주어야 합니다. 먼저 설치할 때 사용했던 파일들이 있는 디렉토리로 이동합니다. 만약 설치할 때 사용했던 파일들이 있는 디렉토리가 없다면 먼저..
우분투에서 아래의 명령어를 통해 api를 gunicorn을 활용하여 띄우려고 할때 gunicorn --bind 0.0.0.0:5000 -w=2 -k=gevent --threads=2 app:app /usr/local/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject return f(*args, **kwds) -- 중략 -- File "/home/azureuser/workplace/projects/QA_Extractor/qna-maker/Qn..
A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements: The area of the rectangular web page you designed must equal to the given target area. The width W should not be larger than the length L, which means L >= W. The differ..
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. Note: 0 ≤ x, y < 231. Example: Input: x = 1, y = 4 Output: 2 Explanation: 1 (0 0 0 1) 4 (0 1 0 0) ↑ ↑ The above arrows point to positions where the corresponding bits are different. Soltuion class Solution: def hammingDist..
S and T are strings composed of lowercase letters. In S, no letter occurs more than once. S was sorted in some custom order previously. We want to permute the characters of T so that they match the order that S was sorted. More specifically, if x occurs before y in S, then x should occur before y in the returned string. Return any permutation of T (as a string) that satisfies this property. Exam..
Pycharm에서 Start SSH Session을 통하여 서버에 접속하여 사용을 하려고하는데 위와 같이 한글에 대한 정보가 모두 깨져서 나오는 경우가 있습니다. 이는 터미널에 설정되어있는 인코딩 정보가 한글과 맞지 않아 발생하는 문제입니다. 이를 해결하는 방법은 다음과 같습니다. Mac OS 의 경우 먼저 상단 바의 PyCharm을 클릭하고 Preferences... 를 클릭하여 환경 설정 창으로 이동합니다. 환경 설정 창에서 좌측 배너의 Tools > SSH Terminal을 선택하면 나오는 창에서 Default encoding을 UTF-8로 바꾸어 준 뒤 OK를 누르면 됩니다. Windows의 경우 먼저 상단 메뉴에서 File > Settings 를 선택합니다. 그 다음 Mac 과 동일하게 Tool..