Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #106: How Long were the Lights On?

myastarling
10 - Fireball

Here are two solutions - one that compares adjacent values, groups by those values and then sums based on those (good for a ginormous dataset) and one that creates all possible minutes when the light is left on and then counts the distinct values (good for smaller datasets).

TomashevskiiVladimir
8 - Asteroid

106.png

martinson
11 - Bolide

👾

Cheers,
martinson

LinkedIN

Bulien
Pilsner
12 - Quasar

My solution:

Spoiler
106.png

RebekaMazuchova
8 - Asteroid

:)

Daniel_Homola
8 - Asteroid

Here!

jaredcoffin
7 - Meteor

Calculated the differences with the Formula tool then correct the duration in the Multi-Row tool with two outcomes.

  1. First solution was to make a Lights On column with accumulation, correcting Duration.
  2. Second solution was to set Duration column to 0 if Exit times were earlier than their successor, and correct Duration to start at previous Exit time if current Enter > prev Exit. 
PuffinPanic
10 - Fireball
10 - Fireball

Got there eventually, but it definitely looks like I could do with working more with the datetime functions.