전체 글
백준에서 C++ 로 풀 때 시간초과 나는 경우
답은 맞는데 시간초과 나는 경우 iostream 때문일 수 있다. ios_base::sync_with_stdio(false); cin.tie(null); 앞에 추가하면 속도를 높일 수 있다. * 특히 입출력이 번갈아 일어나는 상황에서 속도가 빨라짐.
Leet code 가입
부계용으로 하나 만들어서 Problems - Easy 제일 첫번째꺼 문제 풀었다. 이건 너무 쉬움 1. Two Sum (C++) num에 저장된 숫자 2개 중 합이 target인 인덱스 2개를 return 하는 문제 단, 같은 인덱스의 숫자로 더하면 안됨. class Solution { public: vector twoSum(vector& nums, int target) { vector ans; int tot = 0; for (int i=0; i < nums.size(); i++) { for (int j=i+1; j < nums.size(); j++) { tot = nums[i] + nums[j]; if (target == tot) { ans.push_back(i); ans.push_back(j); } ..
PATH 설정하기
Python 설치 후 pip이 설치 안돼서 설치하는 도중 Warning이 발생했다. WARNING: The scripts pip, pip3 and pip3.9 are installed in '/home/tutorial/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. pip이 설치된 경로가 PATH에 포함되어있지 않다는 내용이다. /$HOME/.local/bin 의 경로를 PATH 에 추가하면 해결된다. * $HOME : home directory의 경로를 담은 환경변수 PATH 설정 하는 방..
JSON: javascript 객체 표기법
JSON 사용 데이터 교환용 JSON 구조 중괄호로 감싸는 {"key":value} 구조이다. value 에 들어갈 수 있는 자료형 : 기본 자료형, 배열, 객체 등 예시 : {"contents":"kkk","complete":true} "contents" 라는 이름의 변수에는 'kkk' string 이, "complete" 변수에는 true/false 값이 저장됨 JSON 으로 배열 표현 대괄호로 표현 가능하다. 쉼표(,) 로 구분. 예시 : 위의 JSON 예시가 배열에 넣어진다면 {"list":[{"contents":"practice nodejs","complete":false},{"contents":"mini project : todo list","complete":false}]} JSON 으로 A..
[] ERR_HTTP_HEADERS_SENT : Client 요청에 두 번 이상 응답할 때 발생하는 에러
node.js 를 공부하면서 다음과 같은 에러가 발생하였다 : Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at ServerResponse.setHeader (_http_outgoing.js:558:11) at ServerResponse.header (C:\Users\popo3\Documents\Todo_List\node_modules\express\lib\response.js:767:10) at ServerResponse.json (C:\Users\popo3\Documents\Todo_List\node_modules\express\lib\response.js:264:10) at C:\Users\po..