You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<string>
#include<vector>
#include<algorithm>usingnamespacestd;intgcd(int a, int b) {
while (b != 0) {
int temp = a % b;
a = b;
b = temp;
}
return a;
}
vector<int> solution(int numer1, int denom1, int numer2, int denom2) {
int numerator = numer1 * denom2 + numer2 * denom1;
int denominator = denom1 * denom2;
int common = gcd(numerator, denominator);
numerator /= common;
denominator /= common;
return {numerator, denominator};
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: