honingjs / comments

0 stars 0 forks source link

challenges/adventofcode/2022/day-13 #6

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Advent of Code 2022 - Day 13: Distress Signal Solution - HoningJS

Handle conditional statements carefully

https://honingjs.com/challenges/adventofcode/2022/day-13

AdnanIkram commented 1 year ago

This is amazing. I was able to solve the first part with some brute force recursion which I didnt like. Some how using the same comparison method did not work for the part two, after struggling a lot, and reading amazing solutions (which I didnt understand properly) i concluded 2 things.

1 - my code was pretty bad :( 2 - i dont understand the basics of solving this problem

I was able to get the answer after first using the built in array sort method in js and then applying my comparison method on top of it.

Could you guide me where I went wrong, or perhaps explain your code a bit so I can understand it a bit better.

Thank you

AdnanIkram commented 1 year ago

Also, why flattening works before sorting. I tried it without it and that didnt work either.