Advent of Code 2025

Hi Swift Community!

It's the most Wonderful Time Of The Year. Time to spend with Family and Friends spend on Swift coding challenge fun!

Every December, Eric Wastl publishes Advent of Code, a fun set of coding exercises. One challenge is posted each day from December 1st to December 2512th [1]. The challenges start out easy and increase in difficulty. Here’s the first exercise from last year for example.

You can use whatever programming language and techniques you like to complete the exercises, but of course, we use Swift! Participating is a great way to sharpen your Swift skills and have a little fun with the community.

For those interested, we have a starter template to help you get going, though its not needed per se.

To participate with Swift:

  1. Create an Xcode project (Command Line Tool is fine), Swift Package or clone the starter project
    a. if your repo is public, make sure to exclude the input data from version control
  2. Create an account at Advent of Code (required to use the leaderboard)
  3. Join the Swift community leaderboard to participate with others. Use ID 3315857-05237f97. Up to 200 players can join the leaderboard.
  4. Every day (or as often as you prefer), attempt the challenge using Swift!

The leaderboard will automatically update to show who has completed the challenge and provide a score based on how long it took you. You can always ignore the score of course - it’s just for fun!

We'd encourage you to include a link to your GitHub account where you can post your solution. It’s really neat to see how everyone attempts each day’s challenge: we learn new things about how others use the Swift language, and you can pick up some great tips and techniques from studying others' work.

Look forward to seeing you online!


  1. This year the number of challenges changed from 25 to 12. Meaning that the event will run until mid-december instead of Christmas Day. ↩︎

17 Likes

Count me in. My solutions will be at gereon/AoC2025: Advent of Code 2025 - Codeberg.org

4 Likes

Genuinely excited for this year's Advent of Code! I had a lot of fun last year :grinning_face_with_smiling_eyes:

May even get the chance to try out shiny new Swift features like InlineArray.

I'll share my results here: GitHub - Androp0v/AdventOfCode2025

4 Likes

Long time reader, first time player.

Looking forward to taking some time out of my day to have a little fun.

4 Likes

Also, my stuff can be found here: GitHub - maartene/AoC2025: AoC2025 using Swift

4 Likes

Thanks for sharing - this looks great and glad you link to VS Code Swift too in the starter project - though looks like it is the deprecated extension, rather than the newer one. Would it be possible to update to https://marketplace.visualstudio.com/items?itemName=swiftlang.swift-vscode

1 Like

Nice catch! I created a PR for the repo to change the link.

2 Likes

Checking my Functional style solution by using Swift Algorithms :smiling_face:

2 Likes

Cool solution! :heart_eyes:

Finally the month for Advent of Code and Christmas!

Here’s my repo: GitHub - tommyming/aoc-2025-swift: Doing Advent of Code 2025, using Swift
Have a look if you are interested

1 Like

Also joining again :slight_smile: My 2025 solutions can be found here: AdventOfCode/Sources/Solutions/2025/Days at main · rbruinier/AdventOfCode · GitHub.

1 Like

高手! 失敬失敬

Looking at your solution then look at your Leetcode.

1 Like

Here's my repo:

1 Like

Implemented a circular linkedList. Seemed easiest to me for that time.

Well, I am proceeding bit slow, having the problem understanding the Day 2’s example test case.

  • 95-115 has one invalid ID, 99 << How it’s 99, should not it be 11

  • 998-1012 has one invalid ID, 1010. << & it should be 99

  • 1188511880-1188511890 has one invalid ID, 1188511885. << this 1188

  • 1698522-1698528 contains no invalid IDs. << and this 1698

  • 446443-446449 has one invalid ID, 446446. << and this 44644

  • 38593856-38593862 has one invalid ID, 38593859. << and this should be 3859

Am I missing something ?? :’)

11 is not in the 95…115 range

99 is not in the 998…1012 range

1 Like

Got it. Thought they literally the IDs, we are talking about here. Missed the part where I need to go through the range :slightly_smiling_face:

2 Likes

mine is GitHub - tevelee/AdventOfCode

1 Like

Sadly I'm busy trouble shooting some problems with my VSCode setup so I'm not yet able to use that fancy scaffold I used last year! Ooops!

In the mean time a package per day will work. Sorry for the mess.

1 Like
Day 3 Spoilers

Never been so grateful for Slices and their shared indexing, which I've previously been irritated by. I take it all back. I'm guessing it's not fast but it does get it done!

        var found = ""
        var tapeHead = valuesString.startIndex
        for i in stride(from: cellCount, to: 0, by: -1) {
            let currentSlice = Slice(base: valuesString, bounds: tapeHead..<valuesString.index(valuesString.endIndex, offsetBy: -i+1))
            let max = currentSlice.max()!
            let maxIndex = currentSlice.firstIndex(of: max)! 
            found.append(max)
            tapeHead = valuesString.index(after: maxIndex) //so fancy that this works. 
        }
1 Like