Tag view

#arrays

Cross-subject tag search for related interview cards.

Clear

Results update as you type. Press / to jump straight into search.

Tagged with arrays

25 cards

JavaScript Medium Theory

slice vs splice, map, filter, reduce, forEach, find, some, every, includes, sort, reverse, and array destructuring

Modern array work relies on iteration helpers, search helpers, and knowing which methods mutate the original array.

  • `slice` copies, `splice` mutates
  • `map` transforms and `forEach` does not return a new array
  • `sort` mutates unless you copy first

slice vs splice, map, filter, reduce, forEach, find, some, every, includes, sort, reverse, and array destructuring

Coding Exercises Medium O(n^2)

3 Sum

Sort the array, fix one value at a time, and use two pointers on the remaining range. Skip duplicate anchors and duplicate pointer values so the result contains unique triplets only.

Return all unique triplets in an array whose sum is zero.

Coding Exercises Easy O(log n)

Binary Search

Use left and right pointers, compute the middle index, and discard half the range each step based on the comparison.

Given a sorted list and a target, return the target index or -1 if it is missing.

Coding Exercises Medium O(n)

Container With Most Water

Use left and right pointers, compute the current area, and always move the side with the smaller height because only that can improve the limiting wall.

Find two lines that together hold the maximum area of water.

Coding Exercises Medium O(n)

House Robber

Track the best result when including or excluding the current house. A rolling two-variable DP solution keeps the implementation compact.

Return the maximum amount you can rob from houses without robbing adjacent houses.

Coding Exercises Easy O(n + m)

Intersection of Two Arrays

Convert both arrays to sets, intersect them, and sort the result if you want deterministic output for testing or interviews.

Return the unique values that appear in both arrays.