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

class Solution { public: int oddCells(int m, int n, vector& indices) { vectorx(n,0); vectormat(m,x); for(int x=0; x

class Solution { public: int countGoodRectangles(vector& rectangles) { int smallest=0; vectorv; for(int i =0; i smallest) smallest = tmp; v.push_back(tmp); } int cnt=0; for(int i =0; i

어려워서 남이 풀어놓은 것을 보고 외워서 작성함. 아직은 혼자 짜라고하면 못짤듯하나, recursive를 따라가본 정도로 만족. //spend 7hours to understand. (still not fully understood..) //this is not my own-created code. //thanks to https://leetcode.com/problems/all-possible-full-binary-trees/discuss/1221826/C%2B%2B-Easy-Recursive-No-Extra-Function-Needed-(With-Explanation) /** * Definition for a binary tree node. * struct TreeNode { * int val; * ..

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * }; */ class Solution { public: TreeNode* newNode(int x){ TreeNode* tmp = new Tree..

class Solution { public: vector findingUsersActiveMinutes(vector& logs, int k) { vectorres(k); sort(logs.begin(),logs.end()); sets; int stand = logs[0][0]; for (int i = 0; i < logs.size(); i++) { if (logs[i][0] != stand) { ++res[s.size() - 1]; stand = logs[i][0]; s.clear(); s.insert(logs[i][1]); } else s.insert(logs[i][1]); if(i ==logs.size()-1) ++res[s.size() - 1]; } return res; } };

Graph -> dfs (depth first search) class Solution { public: int target; vector res; vector tmp; void dfs(vector& graph, int currNode = 0) { tmp.push_back(currNode); if (currNode == target) res.push_back(tmp); else { for (int node: graph[currNode]) { dfs(graph, node); } } } vector allPathsSourceTarget(vector& graph) { target = graph.size() - 1; dfs(graph); return res; } };

class Solution { public: int uniqueMorseRepresentations(vector& words) { vectorcode ={".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."}; sets; for(int i =0; i