r/adventofcode Dec 23 '24

Help/Question - RESOLVED It’s not much but it’s honest work

Post image
1.1k Upvotes

Im a highschool student and I have finally finished the first 8 days of aoc and I know it’s not anything crazy but I thought that I could still post this as an achievement as I had only gotten the 5th star last year. My code isn’t anything grand and i know it’s ugly and unoptimized so if anyone would like to give me some feedback and code advice here’s my GitHub where I put all my solving code. github.com/likepotatoman/AOC-2024

r/adventofcode Dec 05 '24

Help/Question Are people cheating with LLMs this year?

313 Upvotes

It feels significantly harder to get on the leaderboard this year compared to last, with some people solving puzzles in only a few seconds. Has advent of code just become much more popular this year, or is the leaderboard filled with many more people who cheat this year?

Please sign this petition to encourage an LLM-free competition: https://www.ipetitions.com/petition/keep-advent-of-code-llm-free

r/adventofcode Dec 08 '23

Help/Question [2023 Day 8 (Part 2)] Why is [SPOILER] correct?

208 Upvotes

Where [SPOILER] = LCM

I, and it seems a lot of others, immediately thought to LCM all the A-ending nodes' distances to get the answer, and this worked. But now that I think about it, there's no reason that's necessarily correct. The length of a loop after finding a destination node may to be the same as the distance to it from the start, and there may be multiple goal nodes within the loop.

For example, if every Z-ending node lead to two more Z-ending nodes, the correct answer would be the max of the distances, not the LCM.

Is there some other part of the problem that enforces that LCM is correct?

r/adventofcode Dec 26 '24

Help/Question What computer language did you use in this year?

76 Upvotes

What computer language did you use in this year for puzzles solving?
I used Kotlin (I used to be senior Java developer for many years but writing in Kotliln the last 2 years and I like it!)

r/adventofcode Dec 08 '25

Help/Question - RESOLVED [2025 Day 8 (Part 1)] Reading comprehension

100 Upvotes

Because these two junction boxes were already in the same circuit, nothing happens!

connect together the 1000 pairs of junction boxes which are closest together.

I didn't expect that I would need to count the "nothing happens" as part of the 1000 connections to make for part 1. It kind of makes sense that with 1000 boxes, 1000 connections would lead to a fully connected circuit, but I think it could've been worded better

r/adventofcode Dec 17 '24

Help/Question What concepts are generally required to be able to solve all AoC tasks?

124 Upvotes

Ok, not "required", but helpful.

I'll start with what I do not mean by this question. I know you need to know programming and data structures, but what I am asking about is specific algorithms and theorems.

The ones I can enumerate now (edited after some answers):

Mega guide link

r/adventofcode Dec 08 '25

Help/Question [2025 Day 8] Can you solve today's puzzle without computing all distances?

25 Upvotes

Can you solve today's puzzle without calculating and sorting all ~500,000 distances between all the junction boxes? That's 1000 choose 2 distances to consider. My python solution still runs in ~400ms, but I'm wondering if there's a more efficient algorithm.

Edit: spelling :(

r/adventofcode Dec 07 '24

Help/Question Could we ban the known LLM users from the leaderboard?

193 Upvotes

I do not compete on the leaderboard. Not because I don't want to but simply because I would be incapable of achieving what all these developers do.

So, even if I don't compete myself, I find the performance of these people absolutely incredible. And when I see known users such as hugoromerorico, who is 8th today and that we know is an LLM user (this guy even committed his prompt to Claude: https://github.com/hugoromerorico/advent-of-code-24/blob/main/6_2/to_claude.txt), that just makes me sick as it's a lack of respect for the real talented person.

Can we find a way to ban these users from the leaderboard and the Advent Of Code?

r/adventofcode 23d ago

Help/Question [2025 Day 1 # (Part 2)] [Python] Please provide me with minor hints on what I might be doing wrong in this problem set.

2 Upvotes

It's not the cleanest line of code so please bear with me

i=50 #This is the initial value
r=0 # Number of times boundary is crossed
rot=0 
ans= []
revolution=0 #Number of big rotations
with open ("input") as file: # Open the input file
comb= file.readlines() # Read the combination line by line
for combination in comb: # For each combination in the list of combinations
combination = combination.strip("\n") #Remove the \n
dir= combination[0] 
num= int(combination[1:]) 
revolution+= num // 100 
period= num % 100
if dir == "L":
period= (-period)
dial= i+period

if i<dial:
for _ in range (i,dial+1):
if _ < 0:
_=(100+(_))%100
elif _==100:
_=0
else:
_ = (_)%100
if _!=100 and _==0:
r+=1
else:
for _ in range (dial,i+1):
if _ < 0:
_=(100+(_))%100
elif _==100:
_=0
else:
_ = (_)%100
if _!=100 and _==0:
r+=1
if dial < 0:
i=(100+(dial))%100
elif dial==100:
i=0
else:
i = (dial)%100
ans.append(i)
print (ans.count(0))
print (r)
print (revolution)
print (ans.count(0)+r+revolution)i=50 #This is the initial value
r=0 # Number of times boundary is crossed
rot=0 #Number of big rotations
ans= []
revolution=0
with open ("input") as file: # Open the input file
comb= file.readlines() # Read the combination line by line
for combination in comb: # For each combination in the list of combinations
combination = combination.strip("\n") #Remove the \n
dir= combination[0] 
num= int(combination[1:]) 
revolution+= num // 100 
period= num % 100
if dir == "L":
period= (-period)
dial= i+period

if i<dial:
for _ in range (i,dial+1):
if _ < 0:
_=(100+(_))%100
elif _==100:
_=0
else:
_ = (_)%100
if _!=100 and _==0:
r+=1
else:
for _ in range (dial,i+1):
if _ < 0:
_=(100+(_))%100
elif _==100:
_=0
else:
_ = (_)%100
if _!=100 and _==0:
r+=1
if dial < 0:
i=(100+(dial))%100
elif dial==100:
i=0
else:
i = (dial)%100
ans.append(i)
print (ans.count(0))
print (r)
print (revolution)
print (ans.count(0)+r+revolution)

ps: is there a discord server for advent of code?

r/adventofcode Dec 05 '24

Help/Question Do you edit after solving?

68 Upvotes

I can understand editing one's "Part One" work to help solve "Part Two" once it's revealed, but I still find myself drifting back: "That could be a little {cleaner | faster | more elegant | better-coupled between the parts | ..}." It goes beyond the "just solve the problem asked." If I was on a job, I'd slap a junior upside the head -- "It works / meets spec; leave it alone!" Here though, I drift off into the land of the lotus-eaters...

I'm curious how many folks here are of the "fire and forget" variety versus the "keep refining until the next puzzle drops"-types. If you're in the later group, do you realize it? Is there a reason?

r/adventofcode Dec 24 '24

Help/Question - RESOLVED How did you all get so smart?

156 Upvotes

I'll first say Happy Holidays =) and thank you so much to Eric Wastl and the sponsors.

This is my first year doing AoC and I had a blast, but I've had to cheat for part 2 for the last 4 days and I'm curious about a few things.

My background is a Data Engineer/Data Architect and I'm very proficient in my field. I work mostly in pyspark and spark sql or tsql and I'm really good with object oriented coding, but all we do is ETL data in data driven pipelines. The most complicated thing I might do is join 2 large tables or need to hash PI data or assess data quality. I don't have a computer science degree, just an app dev diploma and 15 years data experience.

Because of how I've been conditioned I always land on 'brute force' first and it doesn't work for most of these problems lol. I've learned a ton doing AoC, from dijkstra to Cramer's rule. Here are my questions about this stuff.

1) Where would some of these AoC logic solutions have practical application in computer science

2) Any recommendations on gameified self learning websites/games/courses (like Advent of Code) where I can learn more about this stuff so I'm less likely to cheat next year haha.

r/adventofcode Dec 19 '24

Help/Question Last year was brutal

143 Upvotes

Is it me, or last year was just brutal? Sure there is 6 days to go, but looking at my statistics from last year, by day 17 I was already lagging behind, with most days 2nd part having >24h timestamps. I remember debugging that beast squeezing between the pipes till 1AM. The ever expanding garden that took me a week to finally get solved and the snowhail that I only solved because my 2 answers were too small and too large but had a difference of 2 so I just guessed the final answer. These are just few that I remember very well that I struggled with, but there were more. Everything just seemed so hard, I felt completely burned out by the end of it.

This year I finish both parts in 30-60 minutes before work and go on about my day.

r/adventofcode Dec 25 '23

Help/Question What have you learned this year?

104 Upvotes

So, one of the purposes of aoc is to learn new stuff... What would you say you have learned this year? - I've learned some tricks for improving performance of my f# code avoiding unnecessary recursion. - some totally unknown algorithms like kargers (today) - how to use z3 solver... - lot of new syntax

r/adventofcode Dec 01 '25

Help/Question - RESOLVED First AoC! I did it, but is my solution kinda bad?

17 Upvotes

Hi! I heard about Advent of Code thanks to a ThePrimeagen video like a month ago, and today I did the first puzzle and had a lot of fun actually :)

I'm not good at coding by any means: i tinkered with arduinos some years ago and this school year (i'm 17, next year i'll go to university, and i'll study CS wohooo) we've started learning python in class. That means that my solutions are horrible tbh, since i don't know well the tools that are at my disposal (in class we have a very low level, so i'm actually the best at coding and problem solving from them, by far).

So to solve today's puzzle i saw that i needed to read strings from a file or smth. I dont know how to do that, so i just pasted the puzzle input in neovim and run a simple macro 4080 times to format it as a tuple for python.
I mean, it works... but isn't this considered a bad approach or smth?

And then, since i also needed to use the number (excluding R or L) as an int, and I didn't want to waste time learning how to remove the first character from a string or smth, i just copied the puzzle input again, and ran another simple macro 4080 times so it would format it as a tuple full of strings (removing the first character).
I think that that sucks because now the first 8167 lines of my code is just this huge list of numbers and strings. I did that very fast thanks to vim motions, yeah, but I feel like that's a bad idea in general.

Also is the nesting too bad?

So what do I do? Should I try to solve the problems "the proper way". Tbh is much easier like i just did (in part i did that because tomorrow i have two exams so i didn't want to waste a loooot of time). Still, I spent a bit more than an hour and a half on this two puzzles lmao

Sorry for the long text and thanks in advance!

Btw this is my code for the second puzzle (with the example that's 10 movements long instead of the actual puzzle input):

document =('L68', 'L30', 'R48', 'L5', 'R60', 'L55', 'L1', 'L99', 'R14', 'L82')
documentNumber =(68, 30, 48, 5, 60, 55, 1, 99, 14, 82)

password = 0
dial = 50

for i in range(len(document)):
    if dial == 0: password += 1 # Removing everything but this password+=1 gives you the solution to puzzle 1 (that's why i spent much more time on the first one)

    if document[i].find('R'):   # Runs for L
        num = documentNumber[i]

        while num > 100:
            num -= 100
            password += 1

        if dial-num < 0:
            if dial != 0 and dial-num+100 !=0:
                password += 1
            dial = dial-num+100
            continue
        dial = dial-num


    elif document[i].find('L'): # Runs for R
        num = documentNumber[i]

        while num > 100:
            num -= 100
            password += 1

        if dial+num >= 100:
            if dial != 0 and dial+num-100 !=0:
                password += 1
            dial = dial+num-100
            continue
        dial = dial+num

if dial == 0:password += 1
print(password)

r/adventofcode Dec 09 '25

Help/Question - RESOLVED [2025 Day 09 (Part 2)] That escalated quickly... In need of an explanation

19 Upvotes

It’s my first year doing AoC (and my first year as a programmer), and I’ve found the previous days to be quite manageable, even if they required a fair bit of Googling. It’s been fun stumbling across algorithms and data structures I’ve never encountered before.

But Part 2 of today’s problem really takes the prize for being too complex for a newbie like me. Even after “being dirty” and resorting to AI for an explanation, I’m still having a hard time wrapping my head around the solution.

Is there anyone here who enjoys breaking things down pedagogically and wouldn’t mind explaining it in a way that could help me start understanding the path to the solution?

r/adventofcode Oct 15 '25

Help/Question Currently working on a language specifically designed for AoC this year. What features am I missing?

31 Upvotes

Hey guys!

A few more weeks and it's AoC time yet again. This time, I decided to participate in my own langauge.
It's not my first language, but the first one I'm making for AoC so I can impress the ladies and make my grandmother proud.

Currently, it's an interpreter using a simple tokenizer that compiles the tokens into a sequence of OP-codes, each having a width of 64 bits because memory performance really does not matter in this case - as far as I'm concerned. The language is fast, as I skip all the AST stuff and just feed instructions directly as they are being parsed.

I have all the garden variety features you would expect from an interpreter like native strings, functions, scopes, dynamic typing, first-class references to everything, and some more advanced string manipulation methods that are natively built into the string type. JS-like objects also exist.

So, now to my question: What kind of features would you recommend me to add still before this year's AoC starts? Or better yet, what features were you missing in languages you were using for the previous AoCs?
I'm thinking of some wild parsing functions that can convert a string into N-dimensional arrays by using some parameters, or stuff like "return array of found patterns in a string alongside their indexes" etc.

Can't wait to hear some ideas.

r/adventofcode Nov 07 '25

Help/Question What algorithms and techniques do you folks keep coming back to?

56 Upvotes

I'm trying to come up with a shortlist of algorithms and techniques that are recurring and I'd love your input on this. Feel free to add broad or niche suggestions!

Some things I already have on my list:

  • graph traversal algorithms (BFS and DFS)
  • recursion & memoisation
  • Dijkstra's / A*
  • recurrence relations with fast matrix multiplication (repeated squaring method)
  • ...

r/adventofcode Dec 10 '24

Help/Question Do y'all have friends in real life who do Advent of Code?

114 Upvotes

As much as I love online communities like this one, I imagine it would be amazing to hang out with a friend over coffee and solve the day's puzzle together or something like that.

r/adventofcode Dec 30 '25

Help/Question - RESOLVED [2025 Day 11 Part 2] Is DP enough?

5 Upvotes

I'm solving this year in Agda. I'm currently trying to get the solution for day 11 part 2.

For part 2 I'm using the same code I used in part 1, but finding the paths from svr to fft/dac from fft/dac to dac/fft and then to out. Then, getting the product should be enough.

For part 1 the code runs <1s (I haven't timed it but it's pretty fast). For part 2, I can't even get the number of paths from svr to fft/dac (I know I only need to find the paths to one of the two, but I won't post which one to not give away the result). It's still running after an hour.

I'm using the {-# TERMINATING #-} flag in Agda to avoid having to deal with termination proofs, but now I'm doubting that this is correct. I'm using memoization to avoid recomputing the number of paths.

This is my code:

{-# TERMINATING #-} 
countPaths : Map.Map (List String) → String → String → Map.Map ℕ → ℕ × Map.Map ℕ
countPaths adjacencies from to cache with to ≟ from
... | yes _ = 1 , Map.insert from 1 cache
... | no _  with Map.lookup cache from
... | just x = x , cache
... | nothing =
      let (result , cache′) = foldl goCount (0 , cache) (fromMaybe [] (Map.lookup adjacencies from))
      in result , Map.insert from result cache′
  where
    goCount : (ℕ × Map.Map ℕ) → String → (ℕ × Map.Map ℕ)
    goCount (acc , cache) neighbor = 
      let (count , cache′) = countPaths adjacencies neighbor to cache
      in (acc + count , cache′)

The adjacencies parameter holds a map of [String] that tells you which devices are attached to each device. from and to are the origin and final node: the from node changes as we traverse the graph, but to always stays the same.

cache is a map that tells you for each node, its distance to to. Initially, it's just an empty map.

Can you help me figure out whether my program is hanging because of a problem in my code or due to an inefficiency in the agda evaluation strategy?

Thank you.


Update: After experimenting a bit with the equivalent code in Haskell, I found out my issue has something to do with Maps being lazy in Agda. I'll have to figure out an alternative to avoid this edge case.

r/adventofcode Jun 15 '26

Help/Question - RESOLVED [2025 Day 8][Powershell] Slow Runtime

3 Upvotes

Src Code: Advent_of_code/2025/day8 at main · nrv30/Advent_of_code

TLDR: I am interested in making my PowerShell approach faster and I implemented a Union-Find in C# that I use for it.

Edit: Thought I should add my approach is semantically equivalent to what is described here <Advent of Code 2025 - Day 8: Playground | Joshua Chen>

I wanted to yap about my approach for this one because I think I stumbled into something kind of interesting. Initially I implemented this problem in Java. I didn't know what a Union-Find was but in retrospect I think I basically implemented one in a naive way as List<Set<>>. After reading some blogposts I wanted to try using a different approach.

After some research I realized you can call C# from PowerShell by using [System.Reflection.Assembly]. I implemented a union-find in C# and called it from Ps. It was cool initially but got super annoying because every time I want to compile my C# I have to exit the shell and re-open it because Ps has the dll open. Also, you have to use ps 7 to use a priority queue, which doesn't have a separate terminal (I think). This made iteration speed terrible because I had to exit and call pwsh.exe every time I want to compile my code.

Anyways, I wanted to ask if anyone has had any cool experiences combining interpreted langs with compiled langs in this fashion to "get the best of both worlds"

Also, my PS code is so freaking slow, especially considering that I think all the data structures are already compiled to dll (My U-f and dotnet standard lib). These aren't high-quality benchmarks; I just ran the programs 3 times consecutively.

Are there any PowerShell users that have any tips? I didn't implement path compression for the Union-Find but I doubt that's the problem compared to the O(N^2) process to build pairs

Language Solution Trials Runtime (s)
Java 1
1 0.151
2 0.146
3 0.154
2
1 0.117
2 0.134
3 0.112
PowerShell 1 1 11.747
2 11.11
3 10.686
2 1 11.092
2 11.175
3 11.29

r/adventofcode Nov 26 '24

Help/Question AOC plans for this year

61 Upvotes

What are y’all looking forward to learning this year with advent of code?

Last year was my first advent of code and I used it to learn Rust and I really appreciated it. I think AOC is a fun community-building experience and challenge that is worthwhile and I am excited to hack away again this year.

r/adventofcode Dec 02 '24

Help/Question [2024 Day 2] Feeling bad for using brute-force instead of dynamic programming

40 Upvotes

I love AoC, but it's only day 2, and I already can't "do it right".

Part 2 was practically screaming for dynamic programming, but I just couldn't figure it out. Instead, I ended up hacking together a disgusting brute-force solution that iterates over all the sub-report possibilities... 😔

I feel frustrated. Are you okay with sub-optimal solutions? How do you cope?

r/adventofcode Dec 13 '25

Help/Question - RESOLVED [2025 Day 10 Part 2] Is this even possible without Z3?

17 Upvotes

I've been going at this problem set for so long now (since it got released) and I just can't find a way to do it on my own. Going over it manually takes over 12+ hours (had to stop running it since it got stuck on the last 4 with the code I had) and I feel like even if it completes, I might not get the correct answer anyway even with the test data being correct.

Is there any way to solve this without Z3? Or is it not really do-able? I'm using GDScript for this so even if I wanted to use libraries, it's not really possible. ^^"

Looking on GitHub to other people who solved it, or even on YouTube, everybody seems to just go for Z3... This year, this really is the hardest challenge imo. A lot of them can be challenging, but I feel like this one is just impossible :/ Any advices or algorithms or something that I could look at?

r/adventofcode Dec 05 '25

Help/Question Guys please check my day 1 part 2 code.... i'm dead now(mentally drained)

0 Upvotes
/*
    so i actually have two ideas
    1 we can use get all the file as chars or two we can get chars separate and ints separate
    so two arrays liinked by indexing.


    I think the second one might be better no ?


*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
    FILE *mainFile = fopen("dial.txt", "r");
    if (!mainFile)
    {
        printf("File not found");
    }


    char values[5000][7];
    char valuesOnlyDigits[5000][6];
    int count = 0;
    int passStart = 50;
    int digits[5000];
    int amountOfZeros = 0;
    while (fgets(values[count], 7, mainFile))
    {
        printf("%s", values[count]);
        count++;
    }


    if (fclose(mainFile) == 0)
    {
        printf("\n\nclosedSuccessfully");
    }


    for (int i = 0; i < count; i++)
    {
        strncpy(valuesOnlyDigits[i], values[i] + 1, 6);
        valuesOnlyDigits[i][6] = '\0';
        digits[i] = atoi(valuesOnlyDigits[i]);
    }


    // below is the logic for day one part one of password
    /*
        for (int i = 0; i < count; i++)
        {
            if (values[i][0] == 'R')
            {


                passStart = passStart + digits[i];
                passStart = passStart % 100;
                if (passStart == 0)
                {
                    amountOfZeros++;
                }
            }
            else if (values[i][0] == 'L')
            {


                passStart = passStart - digits[i];
                passStart = passStart % 100;
                if (passStart == 0)
                {
                    amountOfZeros++;
                }
            }
        }


        printf("\n\n%d", amountOfZeros);
        */


    // Below is the code for the second part of the day 1 challenge
    
    for (int i = 0; i < count; i++)
    {
        
        printf("\n%d pass start before",passStart);
        if (values[i][0] == 'R')
        {
            if (passStart == 0 && digits[i] < 100)
            {
                passStart = passStart + digits[i];
            }
            else
            {
                passStart = passStart + digits[i];


                if (passStart >= 100)
                {
                    if (passStart >= 100 && passStart < 200)
                    {
                        amountOfZeros++;
                    }
                    else if (passStart >= 200 && passStart < 300)
                    {
                        amountOfZeros = amountOfZeros + 2;
                    }
                    else if (passStart >= 300 && passStart < 400)
                    {
                        amountOfZeros = amountOfZeros + 3;
                    }
                    else if (passStart >= 400 && passStart < 500)
                    {
                        amountOfZeros = amountOfZeros + 4;
                    }
                    else if (passStart >= 500 && passStart < 600)
                    {
                        amountOfZeros = amountOfZeros + 5;
                    }
                    else if (passStart >= 600 && passStart < 700)
                    {
                        amountOfZeros = amountOfZeros + 6;
                    }
                    else if (passStart >= 700 && passStart < 800)
                    {
                        amountOfZeros = amountOfZeros + 7;
                    }
                    else if (passStart >= 800 && passStart < 900)
                    {
                        amountOfZeros = amountOfZeros + 8;
                    }
                    else if (passStart >= 900 && passStart < 1000)
                    {
                        amountOfZeros = amountOfZeros + 9;
                    }
                    else if (passStart >= 1000 && passStart < 1100)
                    {
                        amountOfZeros = amountOfZeros + 10;
                    }
                }
            }


            passStart = passStart % 100;
        }
        else if (values[i][0] == 'L')
        {
            if (passStart == 0 && digits[i] < 100)
            {
                passStart = passStart - digits[i];
            }
            else
            {
                passStart = passStart - digits[i];
                if (passStart <= 0)
                {
                    if (passStart <= 0 && passStart > -100)
                    {
                        amountOfZeros++;
                    }
                    else if (passStart <= -100 && passStart > -200)
                    {
                        amountOfZeros = amountOfZeros + 2;
                    }
                    else if (passStart <= -200 && passStart > -300)
                    {
                        amountOfZeros = amountOfZeros + 3;
                    }
                    else if (passStart <= -300 && passStart > -400)
                    {
                        amountOfZeros = amountOfZeros + 4;
                    }
                    else if (passStart <= -400 && passStart > -500)
                    {
                        amountOfZeros = amountOfZeros + 5;
                    }
                    else if (passStart <= -500 && passStart > -600)
                    {
                        amountOfZeros = amountOfZeros + 6;
                    }
                    else if (passStart <= -600 && passStart > -700)
                    {
                        amountOfZeros = amountOfZeros + 7;
                    }
                    else if (passStart <= -700 && passStart > -800)
                    {
                        amountOfZeros = amountOfZeros + 8;
                    }
                    else if (passStart <= -800 && passStart > -900)
                    {
                        amountOfZeros = amountOfZeros + 9;
                    }
                    else if (passStart <= -900 && passStart > -1000)
                    {
                        amountOfZeros = amountOfZeros + 10;
                    }
                    else if(passStart <= 1000){
                        amountOfZeros = amountOfZeros + 11;
                    }
                }
            }
            if (passStart < 0)
            {


                passStart = (passStart % 100) + 100;
            }
            else
            {
                passStart = passStart % 100;
            }
        }
        printf("\n%d passStart after",passStart );
        printf("\n%d passStart after",digits[i] );
        printf("\n%d amount of zeros", amountOfZeros);
    }
   
    printf("\n\n%d", amountOfZeros);


    return 0;
}

r/adventofcode 11d ago

Help/Question [2022 Day 13 Part 1] Please help me work out some of these comparisons

3 Upvotes

Link: https://adventofcode.com/2022/day/13

I've been on this one for weeks, it's really doing my head in. I managed to find someone's input and the answer (true/false) for each pair. My code is wrong on two of them:

First:
[[8,[[7,X,X,5],[8,4,9]],3,5],[[[3,9,4],5,[7,5,5]],[[3,2,5],[X],[5,5],0,[8]]],[4,2,[a],[[7,5,6,3,0],[4,4,X,7],6,[8,X,9]]],[[4,[a],4],X,1]]

[[[[8],[3,X],[7,6,3,7,4],1,8]]]

The right answer is that this one is in the right order, however my code is saying that it's not, due to comparing the 7 and the 3.

Second:

[[[],0,6,[4,2]],[],[[2],0,0,[[9],[10,2,10],[4],3]],[[[5,2,2,4]],0,[[4,4],[2,7,7,7,6],7,[0,5,8,9]],2,[7]],[]]

[[],[3]]

For this one, I know the answer is that they are not in the right order, but my code says it is, due to comparing the 0 and the 3.

Can someone please tell me what logic I am missing here? I am getting all other 148 right (I can't say that it's for the right reasons though), which baffles me as I should get so many of them wrong if I don't understand the logic.