MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / func17

Function func17

CPP/pandigital_numbers/code.cpp:120–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120vector<int> func17(string str, vector<int> &values)
121{
122 int num = stoi(str);
123 int a, b;
124 b = num % 10;
125 num /= 10;
126 a = num % 10;
127 num /= 10;
128
129 vector<int> vec;
130
131 for (int i = 0; i < values.size(); i++)
132 {
133 // Subtract 5 times the last digit from the rest.
134
135 if ((abs(a * 10 + b - 5 * i)) % 17 == 0 && values[i] == 0)
136 {
137 vec.push_back(i);
138 }
139 }
140
141 return vec;
142}
143
144void func(int n)
145{

Callers 1

funcFunction · 0.85

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected