removing input from git
This commit is contained in:
@@ -15,6 +15,11 @@ std::vector<std::string> read_input_file() {
|
||||
return data;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T peek_back(T it) {
|
||||
return --it;
|
||||
}
|
||||
|
||||
int parse_id(std::string ticket) {
|
||||
std::replace(ticket.begin(), ticket.end(), 'F', '0');
|
||||
std::replace(ticket.begin(), ticket.end(), 'L', '0');
|
||||
@@ -28,8 +33,7 @@ int solve_a(const std::set<int> &ids) { return *ids.rbegin(); }
|
||||
|
||||
int solve_b(const std::set<int> &ids) {
|
||||
for(auto it = ++ids.begin(); it != ids.end(); it++){
|
||||
auto prev = it; --prev;
|
||||
if(*prev + 2 == *it) return *it - 1;
|
||||
if(*peek_back(it) + 2 == *it) return *it - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user