https://leetcode.com/problems/find-all-k-distant-indices-in-an-array/


Runtime: 4531 ms, faster than 100.00% of TypeScript online submissions for Find All K-Distant Indices in an Array.

Memory Usage: 50 MB, less than 100.00% of TypeScript online submissions for Find All K-Distant Indices in an Array.



```typescript
function findKDistantIndices(nums: number[], key: number, k: number): number[] {
    //9:13
    let list = []
    for (const [j, value] of nums.entries()) {
        if (nums[j] === key) {
            let target_j = Math.abs(k - j)
            for (const [i, _] of nums.entries()) {
                if (Math.abs(i-j) <= k) {
                    if (!list.includes(i)) {
                        list.push(i);
                    }
                }
            }
        }
    }
    return list
    //9:16
    //debug and redesign until 9:38
};
```
