#INFO 난이도 : Easy 알고리즘 : Stack 출처 : https://leetcode.com/problems/valid-parentheses/ Valid Parentheses - 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 #SOLVE 스택 자료구조를 활용하면 간단하게 풀이할 수 있는 문제이다. 문자열 s 가 매개변수로 주어지며, s는 '(' , ')' , '{' , '}' , '[', ']' 문자 만을 포함한다. 여는 괄호는 반드시 그에 맞는 닫는 괄..
#INFO 난이도 : Easy 문제 유형 : 구현 출처 : https://leetcode.com/problems/concatenation-of-array/ #SOLVE 주어진 배열을 그대로 복사하여 뒤에 추가한 새로운 배열을 만들면 되는 간단한 문제이다. C++ STL Vector 컨테이너에서 제공하는 insert 멤버함수를 사용해 문제를 풀이했다. → insert member function vector::iterator it = nums.insert(nums.end(), nums.begin(), nums.end()); #CODE class Solution { public: vector getConcatenation(vector& nums) { vector::iterator it = nums.inser..
[C++] insert member function *개인적인 공부 내용을 기록하는 용도로 작성한 글 이기에 잘못된 내용을 포함하고 있을 수 있습니다. _content #1 insert member function #2 두 벡터 연결하기 _Related posts [C++ STL] Vector Container 사용법 _reference https://cplusplus.com/reference/vector/vector/insert/ #1 insert member function C++ STL vector는 특정 원소 혹은 특정 범위의 원소들을 벡터의 원하는 위치에 추가할 수 있도록 도와주는 insert 멤버 함수를 제공한다. iterator insert (const_iterator position, co..
#INFO Rate : 900 출처 : Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2) https://codeforces.com/problemset/problem/1075/A #SOLVE 처음에는 각 퀸과 코인 사이의 거리를 좌표로 나타내어 점과 직선 사이의 거리 공식을 이용해 문제를 풀이 하고자 하였다. #include using namespace std; int main(){ long long n, r, c; cin >> n >> r >> c; long long whiteLen = (r - 1) * (r - 1) + (c - 1) * (c - 1); long long blackLen = (n - r) * (n - r) + (n - c) * (n - ..
#INFO RATE : 800 출처 : Codeforces Round #479 (Div. 3) https://codeforces.com/problemset/problem/977/A #SOLVE 문제에서 주어진 조건대로 그대로 풀이하기만 하면 되는 간단한 문제였다. if the last digit of the number is non-zero, she decreases the number by one 만약 digit(n)의 마지막 자리의 수가 0으로 끝나지 않는다면 1을 뺀다. if the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit). 만약 digit(n)의 마지막 자리의 수가 0으로 ..