summaryrefslogtreecommitdiff
path: root/5
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2020-12-09 11:54:56 +0100
committerBond_009 <bond.009@outlook.com>2020-12-09 11:55:11 +0100
commit2f29af718b7cf4e769cfb3fc351054453d193c42 (patch)
tree1249b010c070a58fa121db62724c27e5494469af /5
parent6ee8e076d0b8630c4d78e7e88f1e44f5c7ba3854 (diff)
Minor improvements
Diffstat (limited to '5')
-rw-r--r--5/part2.c7
-rw-r--r--5/part2_fast.c7
2 files changed, 6 insertions, 8 deletions
diff --git a/5/part2.c b/5/part2.c
index 36364c2..396ea76 100644
--- a/5/part2.c
+++ b/5/part2.c
@@ -68,13 +68,12 @@ int missing_seat_id(const char *filename)
int max = 0;
while (fgets(buffer, 16, file)) {
int tmp = seat_id(buffer);
- if (tmp > max) {
- max = tmp;
- }
-
if (tmp < min) {
min = tmp;
}
+ else if (tmp > max) {
+ max = tmp;
+ }
table[tmp] = 1;
}
diff --git a/5/part2_fast.c b/5/part2_fast.c
index 9c4753e..2334390 100644
--- a/5/part2_fast.c
+++ b/5/part2_fast.c
@@ -59,13 +59,12 @@ int missing_seat_id(const char *filename)
int max = 0;
while (fgets(buffer, 16, file)) {
int tmp = seat_id(buffer);
- if (tmp > max) {
- max = tmp;
- }
-
if (tmp < min) {
min = tmp;
}
+ else if (tmp > max) {
+ max = tmp;
+ }
table[tmp] = 1;
}