Skip to main content

Posts

Featured

Advent of Code 2020 | Day 4 | List<String>.contains()

Difficulty is increasing as the challenge is continuing and a bit more of thinking will be needed, it's time to start! Im pretty sure theres no way to compare the passports with validity requirements without using List String or array - we need to change the spaces to newlines or any other way as well, because there's no chance of splitting() we could use.  As usual for first ' splitting ' of the String, we use our line scanner , reformatting the passport file is necessary in order to get all the values correctly, there was no order or rule of sorting, now we have it. So if the line is blank we know that the passport we were checking right now is over and we can proceed to another one. Next we check if the  list has all the required values and if it has, valids will increase, don't forget to clear() the array for next passport. At the end we can print out the result, also keep in mind that the scanner must be closed to avoid memory leaks! I actually hadn'

Latest Posts

Advent of Code 2020 | Day 3 | char[index] = value;

Advent Of Code 2020 | Day 2 | split() string

Advent of Code 2020 | Day 1 | for() loop

Info

RSS FEED

Crypto prices