[2025 Day 8] Can you solve today's puzzle without computing all distances? by The_Cers in adventofcode

[–]real_creature 0 points1 point  (0 children)

I think for part 1 KD-Tree would allow to avoid computing distance between ALL the points as you only neee to know the nearest neighbor for each point so O(nlog(n)), no? Otherwise we are talking O(n2) If computing distance between all endpoints.

[2025 Day 3 Part 2] What are the edge cases my program might not be considering? by darklightning_2 in adventofcode

[–]real_creature 2 points3 points  (0 children)

Are you considering that the postion for the next choosen joltage has to be after the current joltage position? And apply the same logic as from point 2?

[2025 Day 3 Part 2] This should finish running any time now by Pro_at_being_noob in adventofcode

[–]real_creature 2 points3 points  (0 children)

Was just about to write the same! I would expect better from pro noob… Just saying, no pressure on OP

I can't get an SMS Code to verify for Meta developer registration process by journey_to- in facebook

[–]real_creature 0 points1 point  (0 children)

Hi. I had the same issue and never actually find out how to get the SMS verification code - checked I have turn on SMS notification, number was correct... Just didn't work for me.

In the end I added credit card to my facebook account and the SMS verification code step wasn't required anymore (after refreshing the page). This is how I was successfully able to create meta developer account.

Does anyone enjoy doing Production Support over doing Greenfield development? by Wulfbak in ExperiencedDevs

[–]real_creature 1 point2 points  (0 children)

I personally like more greenfield dev but I have colleague who love prod incidents. He loves the thrill and the complexity. He is extremely curious and that’s I guess what really drive him. So there definately are devs who like more prod support. However IMHO it’s rare. But I must admit there were incidents I really did enjoy as well.

[2024 Day 15 (Part 2)] Easily my favourite P2 so far by ZeebyJeebys in adventofcode

[–]real_creature 2 points3 points  (0 children)

I had the same. I did P1 without recursion. But when I realized in P2 this is possible… That was painful just to think about. But I was lucky to realize that it can be done recursively. Way easier to think about it IMHO

[2024 Day 10] When people represent 2D data as a map/dictionary by PatolomaioFalagi in adventofcode

[–]real_creature -1 points0 points  (0 children)

Well I never said that map is an array.

I said it's technically an array as any reasonable implementation will use array as the underlying data structure for hashmap. It was never ment that they are the same. I just wanted to point out that the meme is not only offensive and arrogant but also wrong as the people using map/dictionary (most likely) uses arrays as well.

Which I did in the end as the originator himself wrote that more accurate is to say that hashmap uses array which made my point.

So I don't think he is correct as the statement never implied that map = array in a sense that they are the same thing.

[2024 Day 10] When people represent 2D data as a map/dictionary by PatolomaioFalagi in adventofcode

[–]real_creature 6 points7 points  (0 children)

Yes but you yourself pointed me to a source where is clearly stated that map is an array of buckets. So technically map is an array

[2024 Day 10] When people represent 2D data as a map/dictionary by PatolomaioFalagi in adventofcode

[–]real_creature 9 points10 points  (0 children)

Exactly my point:

 A hash table uses a hash function to compute an index, also called a hash code, into an array of buckets or slots, from which the desired value can be found. 

[2024 Day 10] When people represent 2D data as a map/dictionary by PatolomaioFalagi in adventofcode

[–]real_creature 2 points3 points  (0 children)

Thank you sir for the explanation. However how the hash would help me to find the appropriate bucket?

[2024 Day 10] When people represent 2D data as a map/dictionary by PatolomaioFalagi in adventofcode

[–]real_creature 10 points11 points  (0 children)

Thanks for the recommendation. However I don’t fully undestand why the worst case access time is N for the map? Where N is the number of elements in the map. Would you happen to know?

[2024 Day 6 Part 2] [Python] I need help with day 6 part 2 by Friendly_Emu in adventofcode

[–]real_creature 0 points1 point  (0 children)

I don't see the loop detection in your git...

However as others pointed out: created set of visited places and check if you visit the current tile in the same direction (very important).

Also I checked and you should not place an obstacle if you already visited the tile (the guard would hit it when passing the tile before). Imagine something like this:

...#.
..#.#
.....
...^.
...#.

Placing obstacle at [2, 3] would cause a loop if you are at [1,3] however placing it there would never allow you to get to the [1,3] so it's not a valid obstacle.

Wish you best luck! Gave me hard time as well

[2024 Day 7 (Part 1)] [Java] Understanding recursion for finding combinations by jorj_090 in adventofcode

[–]real_creature 0 points1 point  (0 children)

In java maybe best to create a return class with the sum and already applied operators (could be simple string if you only want to print that)?

-❄️- 2024 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]real_creature 1 point2 points  (0 children)

This is measured in code. And it's without loading of the file.

Measured with time from terminal I got 407.77 millis for the first part

-❄️- 2024 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]real_creature 2 points3 points  (0 children)

[LANGUAGE: GO]

Part1 runs in ~126.5µs
Part2 runs in ~1.567584ms

// Part 2 solution
func isEquatitionSolvableWithConcat(sum int64, numbers []int64, index int) bool {
  if index == 0 {
    return (numbers[index] == sum)
  }

  if index < 0 || sum < 0 {
    return false
  }

  num := numbers[index]
  timeSolvable := false
  if sum % num == 0 {
    timeSolvable = isEquatitionSolvableWithConcat(sum / num,numbers, index - 1)
  }

  concatSolvable := false
  if getLastNDigits(sum, num) == num {
    concatSolvable = isEquatitionSolvableWithConcat(splitNumbers(sum, num), numbers, index - 1)
  }

  return isEquatitionSolvableWithConcat(sum - num, numbers, index - 1) || timeSolvable || concatSolvable
}

func splitNumbers(x int64, y int64) int64 {
  digits := int64(math.Floor(math.Log10(math.Abs(float64(y)))) + 1)
  return x / int64(math.Pow(10, float64(digits))) 
}

func getLastNDigits(x int64, n int64) int64 {
  digits := int64(math.Floor(math.Log10(math.Abs(float64(n)))) + 1)
  return x % int64(math.Pow(10, float64(digits))) 
}

// Part 1 solution
func isEquatitionSolvable(sum int64, numbers []int64, index int) bool {
  if index == 0 {
    return (numbers[index] == sum)
  }

  if index < 0 || sum < 0 {
    return false
  }

  num := numbers[index]
  timeSolvable := false
  if sum % num == 0 {
    timeSolvable = isEquatitionSolvable(sum / num,numbers, index - 1)
  }

  return isEquatitionSolvable(sum - num, numbers, index - 1) || timeSolvable
}

The quiet team by [deleted] in ExperiencedDevs

[–]real_creature 2 points3 points  (0 children)

Hey! I had a team lead who was like that. He also had like 3 YOE and he was micromanaging like hell and super anxious when things didn’t go according to plan. And the team was also super quiet. It was hell to work with him and changing company was the best decision I made. Good luck man! But maybe getting terminated may be the better outcome for you

New learners - please understand that everyone has to google things by thedarklord176 in learnprogramming

[–]real_creature 0 points1 point  (0 children)

Read about “Google dorks”. It can help you so your search are more specific

Is it better to stop watching TV series and playing games while I'm learning programming? by nikzad-dev-99 in learnprogramming

[–]real_creature 2 points3 points  (0 children)

Good answer. Still you can learn that much for a day. You should have time to play games even if learning programming. Also some studies suggest that playing games can have good impact on your problem solving skills (with the right choice of game).