DeepSeek V3.1 vs Claude 3.5 Sonnet (2024-06-20)

completed
#14🗃️ Find the gift patheasyView on AdventJS
+
# Challenge \#14: 🗃️ Find the gift path 





EASY

At the North Pole, the elves have simplified their storage system to avoid mistakes.

They now keep the presents in a **magical object with limited depth**, where **each value appears only once**.

Santa needs a quick way to know **which path of keys** he must follow to find a specific present.

Your task is to write a function that, given an object and a value, returns the **array of keys** that must be traversed to reach that value.

**Rules:**

- The object has **at most 3 levels of depth**.
- The value to search for **appears at most once**.
- The object only contains **other objects and primitive values** (strings, numbers, booleans).
- If the value does not exist, return an empty array.

**Examples:**

```js
const workshop = {
  storage: {
    shelf: {
      box1: 'train',
      box2: 'switch'
    },
    box: 'car'
  },
  gift: 'doll'
}

findGiftPath(workshop, 'train')
// ➜ ['storage', 'shelf', 'box1']

findGiftPath(workshop, 'switch')
// ➜ ['storage', 'shelf', 'box2']

findGiftPath(workshop, 'car')
// ➜ ['storage', 'box']

findGiftPath(workshop, 'doll')
// ➜ ['gift']

findGiftPath(workshop, 'plane')
// ➜ []
```
In Queue

Your battle is waiting in the queue. It will start automatically when a slot becomes available.