๐Ÿ“ฆ Array Problems


Welcome to the Array section of JDCodebase! Arrays are one of the most fundamental and frequently used data structures in programming. Most DSA problems begin here.

Learning how to manipulate and traverse arrays is essential for becoming a strong problem-solver. Master key concepts and strengthen your foundation with these curated problems.

๐Ÿง  What Youโ€™ll Learn

  • Basics: Traversal, insertion, deletion
  • Prefix sums, difference arrays, and window-based patterns
  • Sorting, searching, and optimizations with pointers
  • Pattern recognition like frequency counts, merging, etc.

๐Ÿ› ๏ธ Useful JavaScript Methods

  • arr.push(val) โ€” add at end
  • arr.pop() โ€” remove from end
  • arr.shift(), arr.unshift(val) โ€” front operations
  • arr.slice(start, end) โ€” get subarray
  • arr.splice(index, count) โ€” remove or insert
  • arr.includes(val), arr.indexOf(val)
  • arr.sort(), arr.reverse()

๐Ÿ“ Problems List

  1. Two Sum (#1)
  2. Find Numbers with Even Number of Digits (#1295)
  3. Concatenation of Array (#1929)
  4. Build Array from Permutation (#1920)
  5. Shuffle the Array (#1470)
  6. Kids With the Greatest Number of Candies (#1431)
  7. Squares of a Sorted Array (#977)
  8. Two Sum II - Input array is sorted (#167)
  9. Merge Sorted Array (#88)
  10. Move Zeroes (#283)
  11. Remove Duplicates from Sorted Array (#26)
  12. Remove Element (#27)
  13. Sort Colors (#75)
  14. Shortest Distance to a Character (#821)
  15. Sort Array by Parity (#905)
  16. Contains Duplicate II (#219)
  17. Longest Harmonious Subsequence (#594)
  18. Maximum Average Subarray I (#643)