Arrays Easy
What pattern does this problem use? An event ticketing platform receives a batch of ticket IDs for validation. Before processing, it needs to reject any batch that contains a duplicate ID. Given a list of ticket IDs, return true if any ID appears more than once.
Example: [TK001, TK004, TK002, TK001] → true (TK001 appears twice).
Pick a pattern:
Hash Map Store and look up values by key in O(1) Set Track existence, have I seen this before? Frequency Map Count how many times each value appears Two Pointers Two index markers moving through data Sliding Window A moving subarray over a sequence Stack Last-in, first-out, track recent items Binary Search Halve the search space on sorted data Linked List Traverse and rewire .next pointers Kadane's Algorithm Maximum sum of a contiguous subarray Tree Traversal Visit every node recursively Tracking Minimum Keep a running minimum or maximum Graph Traversal DFS or BFS through a grid or graph Dynamic Programming Build answers from smaller subproblems Backtracking Choose → explore → undo to enumerate all solutions Prefix Sum Precompute running totals to answer range queries in O(1) Intervals Sort by start time and merge overlapping ranges Bit Manipulation Use XOR, AND, OR to work directly on binary representations Heap / Priority Queue Efficiently track the smallest or largest among a dynamic set Two Heaps Split data into two halves to access both extremes in O(1) Topological Sort Order dependencies — process prerequisites before dependents Divide and Conquer Split into halves, solve each, merge results Trie Prefix tree for fast multi-word search and autocomplete Greedy At each step, choose the locally best option and commit Monotonic Queue A deque that stays sorted to query range min/max in O(1) K-Way Merge Merge k sorted sequences using a min-heap to pick the next element Fast and Slow Pointers Two pointers at different speeds to detect cycles or find midpoints Cyclic Sort Place each number at its correct index in O(n) using swaps Matrix Traversal BFS/DFS over a 2D grid treating cells as graph nodes Sorting Algorithms Divide-and-conquer sorting — merge sort, quick sort Memoization Cache recursive results to avoid redundant computation Union-Find Track connected components with near-O(1) union and find
Check my answer