Skip to content

Commit

Permalink
이슈 #389에서 솔루션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 26, 2024
1 parent 9841db0 commit 39089e7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Programmers/다음에_올_숫자.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <string>
#include <vector>

using namespace std;

int solution(vector<int> common) {
int diff = common[1] - common[0];
if (common[2] - common[1] == diff) {
return common.back() + diff;
} else {
int ratio = common[1] / common[0];
return common.back() * ratio;
}
}

0 comments on commit 39089e7

Please sign in to comment.