Skip to content

Instantly share code, notes, and snippets.

View nerdyalgorithm's full-sized avatar
🎯
Focusing

Angelic nerdyalgorithm

🎯
Focusing
View GitHub Profile
@nerdyalgorithm
nerdyalgorithm / leetcode-2942-find-words-containing.md
Created August 5, 2025 19:38
leetcode-2942-find words containing character

🧠 Approach

Given a list of words and a character x, we need to return the indices of the words that contain that character.

I used a basic loop with enumerate() to track both the index and the word. If the character x is found in the word (if x in word:), I store the index.

@nerdyalgorithm
nerdyalgorithm / LeetCode 1920.md
Last active August 5, 2025 19:20
LeetCode 1920 — Build Array from Permutation

QUESTION

Given a zero-based permutation nums (0-indexed), build an array ans of the same length where ans[i] = nums[nums[i]] for each 0 <= i < nums.length and return it.

APPROACH

The problem says to return an array where ans[i] = nums[nums[i]].