[LeetCode] 70. Climbing Stairs 문제 풀이 C++
·
Archive/ProblemSolving
#INFO 난이도 : Easy 출처 : https://leetcode.com/problems/climbing-stairs/ Climbing Stairs - 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 DP(Dynamic Programming) Algorithm에 대한 선수 지식이 있다면 쉽게 풀이할 수 있는 문제입니다. Bottom-up 방식을 사용해 문제를 풀이했습니다. → Dynamic Programming 우선, stairs 벡터를 생성해 줍..
[LeetCode] 169. Majority Element 문제 풀이 C++ (feat. 과반수 투표 알고리즘)
·
Archive/ProblemSolving
#INFO 난이도 : Easy 출처 : https://leetcode.com/problems/majority-element/ Majority Element - 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 다양한 방식으로 접근할 수 있는 문제입니다. 비효율적인 코드로도 풀이할 수 있지만 Follow-up 조건인 Time Complexity - Linear Time & Space Complexity - O(1) 을 지켜서 문제를 풀이하고자 할 경우엔 ..
[LeetCode] 1929. Concatenation of Array 문제 풀이 C++
·
Archive/ProblemSolving
#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..