일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- leetcode
- 주정부이민
- 위니펙
- mpnp
- MATLAB
- EOI
- 머신러닝
- 조지아텍
- 컴퓨터과학과
- 방송통신대학교
- 프로그래머스
- cpp
- omscs
- LV1
- LAA
- C++
- Plotting
- machine learning
- 기본
- 개발자
- 매트랩
- 선형대수
- 알고리즘
- 코딩테스트
- 온라인석사
- 캐나다 영주권
- 방통대
- Deep learning
- 딥러닝
- zeros
- Today
- Total
목록개발 로그 (114)
Byte by Byte

배운 점 : 1) pair의 second value로 sorting하고 싶을 때는, sort parameter에 cmp함수(외부에 작성)를 추가. 2) pair를 대입하는 STL : vector.emplace_back( i , value) 주의할점은 i는 iterator성격의 값만 넣어야 함. (링크 참고) https://www.geeksforgeeks.org/vector-emplace-function-in-c-stl/ 3) 0으로 나누면 오류남. 항상 체크할 것. #include #include #include #include using namespace std; bool cmp(const pair& a, const pair& b) { if (a.second == b.second) return a.fi..

numpy를 이용하여, 파이썬 문제를 처음 풀어봤음. for loop가 없어 굉장히 군더더기 없이 간단하고 깔끔하다. 주의할 점은, numpy는 ndarray이고, 답안 변수 answer는 list형식이라, tolist()를 써서 형변환을 해줘야 한다는 것. import numpy as np def solution(arr1, arr2): return (np.array(arr1) + np.array(arr2)).tolist()

정렬하고, 달라지는 지점을 하나씩 더하면, 내가 고를 수 있는 방법의 가지수가 된다. 내가 고를 수 있는 수와 같으면 return. #include #include using namespace std; int solution(vector nums) { int answer = 1; sort(nums.begin(),nums.end()); for(int i =0; i < nums.size()-1; i++){ if(answer == (nums.size()/2)) return answer; if(nums[i]!=nums[i+1]) answer++; } return answer; } unordered set을 왜 생각못했을까. 아래는 unordered set을 활용한 다른 사람의 풀이. 1. 중복을 허용하지 않는다..

여기서는 배울 점이 크게 2가지가 있다. 1) unordered_map에 데이터를 넣는법(stirng,int pair한정)과, 2) 콜론(:)과 auto를 활용한 for문 작성법. 1)unordered_map에 데이터를 넣는법 vector container 쓸때는 push_back해서 뒤에서부터 차례로 넣었는데, map은 (string, int) pair일 경우, x[key]++; 하면 그냥 넣어진다. int의 경우 값을 지정하지 않으면 default로 0이 저장되어 잇나보다. 2)콜론(:)과 auto를 활용한 for문 작성법 ' : ' 내가 반복자로 쓸 데이터타입과 변수명을 지정하고, 그 반복자를 적용할 집합?만 지정해주면 된다. string 변수명 : 적용할 집합 for( string name : p..

#include #include using namespace std; string solution(vector table, vector languages, vector preference) { string answer = ""; vectortemp; int baseScore = 6; int intermSum = 0; int highScore = 0; for (int i = 0; i < table.size(); i++) { string word = ""; for (int p = 0; p < table[i].size(); p++) { if (table[i][p] != ' ') { word += table[i][p]; if (p == table[i].size() - 1) temp.push_back(word);..

#include #include using namespace std; int solution(vector board, vector moves) { int answer = 0; vector container; int temp =0; for(int m = 0; m

class Solution { public: string sortSentence(string s) { //sentence를 word로 쪼개어 vector으로 저장 vectortempVec; for (int i = 0; i s.size()) break; } //쪼갠 word를 word옆 숫자의 순서대로 res(string)에 삽입 string res = ""; int k = '1'; while (1..