dsa2 min read
Find All Duplicates in an Array [Medium] — Index as Hash
Find all integers that appear twice using index-sign-marking trick in O(n) time and O(1) extra space.
Read →
1575 articles
Find all integers that appear twice using index-sign-marking trick in O(n) time and O(1) extra space.
Decode a run-length-encoded string like "3[a2[bc]]" = "abcbcabcbcabcbc" using a stack for nested brackets.
Find all unique combinations that sum to target where each number may be used once, skipping duplicates at each recursion level.
Search for a word in a 2D grid using DFS backtracking with in-place visited marking.
Determine if there exists an increasing subsequence of length 3 using two greedy variables in O(n) time O(1) space.