자료구조 알고리즘/코딩테스트

https://dev.mysql.com/doc/refman/8.0/en/comparison-operators.html#operator_equal-to MySQL :: MySQL 8.0 Reference Manual :: 12.4.2 Comparison Functions and Operators 12.4.2 Comparison Functions and Operators Table 12.4 Comparison Operators Name Description > Greater than operator >= Greater than or equal operator < Less than operator , != Not equal operator
https://leetcode.com/problems/find-customer-referee/ Find Customer Referee - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com != 서로 같은 뜻으로 같지 않다를 나타내며 성능 차이는 없다. 다만, 문제에서도 알 수 있듯이 NULL은 처리가 되지 않기 때문에 따로 처리해줘야 한다. Reference https://dev.mysql.com/doc/refman/8.0/en/comparison-operators..
언어 : C++ 통과 : O 내 소스 #include #include #include using namespace std; vector solution(vector lottos, vector win_nums) { vector answer; int zero_cnt = 0; int match_cnt = 0; int max_rank = 0; int min_rank = 0; for(vector::iterator iter_lo = lottos.begin(); iter_lo != lottos.end(); iter_lo++) { if (*iter_lo == 0) { zero_cnt++; continue; } for(vector::iterator iter_win = win_nums.begin(); iter_win !=..
사용언어 : C++ 통과여부 : O 내 소스 : // 신고 결고 받기 #include #include #include #include #include using namespace std; vector solution(vector id_list, vector report, int k_stop) { vector answer; answer.assign(id_list.size(), 0); // stop_list : 신고당한 횟수 vector stop_list; stop_list.assign(id_list.size(), 0); // answer_list : 해당하는 유저 여부 (1: true, 0: false) -> 이걸로 더해줄 예정. vector answer_list; answer_list.assign(id_..
Insert into a Cyclic Sorted List 내가 푼 것 넘 조잡해요 ㅠ 변수를 더 안썼다는 것에 의미를 조금 부여하고, 생성자 활용해서 next 추가한 것을 베스트 답안을 참고해서 보완해야되겠다. -> 주어진 것 잘 활용하기.. /* // Definition for a Node. class Node { public: int val; Node* next; Node() {} Node(int _val) { val = _val; next = NULL; } Node(int _val, Node* _next) { val = _val; next = _next; } }; */ class Solution { public: Node* insert(Node* head, int insertVal) { if (!..
Flatten a Multilevel Doubly Linked List 내가 푼 것 못품 문제점 문제를 잘못 이해했다. 재귀 못한다. dfs 제대로 구현을 못한다. prev 값을 넣어줘야하는 것을 몰랐다.(문제이해잘못에 포함) 베스트 /* // Definition for a Node. class Node { public: int val; Node* prev; Node* next; Node* child; }; */ class Solution { public: Node* flatten(Node* head) { Node* temp=head; stack st; while (head!=NULL) { if (head->child!=NULL) { if(head->next != NULL) st.push(head->ne..
Add Two Numbers Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com 내가 한 것 하다가 도무지 안되겠어서 참고했다. 내 문제의 해결법은 새로운 변수 head 를 놔두고 그 head->next 를 마지막에 리턴해줘서 쭉 이어져 보이도록 하는 것이였다. class Solution { public: ListNode* addTwoNumbers(List..
Merge Two Sorted Lists Merge Two Sorted Lists - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 내가 한 것 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * Li..
내공얌냠
'자료구조 알고리즘/코딩테스트' 카테고리의 글 목록 (6 Page)