반응형 [PCCP] Lv2: 영어 끝말잇기(12981) 해설 문제- 문제 링크: 영어 끝말잇기 해설- 자료구조: - 시간복잡도: (풀이과정)1) 2) 3) 4) 코드(C언어)solution 1)더보기#includesolution 2)더보기#includesolution 3)더보기#include (C++)solution 1)- N: words의 길이- words의 길이만큼 반복문을 순회하고 각 연산의 시간 복잡도는 O(1)이므로 최종 시간 복잡도는 O(N)더보기#include #include #include using namespace std;vector solution(int n, vector words) { vector answer(2, 0); unordered_set usedWords; usedWords.insert(words[0]);.. 2024. 12. 24. 이전 1 다음 반응형