0% found this document useful (0 votes)
6 views6 pages

Array Patterns

The document outlines various array problem-solving patterns used in HackerRank and LeetCode, categorizing them into eight distinct patterns such as Basic Traversal, Prefix Sum, Two Pointers, Sliding Window, and more. Each pattern includes example problems from HackerRank and key concepts they teach, emphasizing the importance of mastering these patterns for coding interviews. Additionally, it highlights high-value word problems that are essential for placement preparation.

Uploaded by

jan.arcade.2026
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views6 pages

Array Patterns

The document outlines various array problem-solving patterns used in HackerRank and LeetCode, categorizing them into eight distinct patterns such as Basic Traversal, Prefix Sum, Two Pointers, Sliding Window, and more. Each pattern includes example problems from HackerRank and key concepts they teach, emphasizing the importance of mastering these patterns for coding interviews. Additionally, it highlights high-value word problems that are essential for placement preparation.

Uploaded by

jan.arcade.2026
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Array Patterns → HackerRank Word Problems (Perfect Match List)

🟢 Pattern 1 — Basic Traversal & Simulation

LeetCode Pattern:
 Simple loops, counting, rearrangement

HackerRank Word Problems:

1. Simple Array Sum


2. Compare the Triplets

3. A Very Big Sum


4. Plus Minus

5. Mini-Max Sum
6. Birthday Cake Candles

📌 What they teach:


 Loop control

 Edge cases

 Overflow

 Min / Max logic

🟢 Pattern 2 — Prefix Sum / Subarray Sum


LeetCode Pattern:

 Subarray sum = k
 Range sum queries

HackerRank Word Problems:

1. Subarray Division (Birthday Chocolate)

2. Array Manipulation ⭐
3. Sparse Arrays

4. The Full Counting Sort

📌 What they teach:

 Prefix sum optimization

 Efficient range update

 Frequency arrays
🔵 Pattern 3 — Two Pointers
LeetCode Pattern:

 Pair sum
 Sorted arrays

 Min difference

HackerRank Word Problems:

1. Pairs ⭐

2. Ice Cream Parlor ⭐


3. Beautiful Pairs

4. Closest Numbers

📌 What they teach:


 Searching pairs

 Difference-based problems
 Sorted traversal logic

🟢 Pattern 4 — Sliding Window

LeetCode Pattern:

 Longest / shortest subarray

 Fixed & variable window

HackerRank Word Problems:

1. Maximum Subarray Sum (Modulo M) ⭐


2. Picking Numbers

3. Maximize It!
4. Gemstones

📌 What they teach:


 Window expansion + shrinking

 Frequency window tracking

🟢 Pattern 5 — Kadane / Max Subarray


LeetCode Pattern:
 Maximum subarray sum

 Maximum product

HackerRank Word Problems:

1. The Maximum Subarray ⭐

2. Sherlock and Array

3. Max Subarray Problem

📌 What they teach:

 Continuous segment optimization

 Prefix vs Kadane thinking

🔴 Pattern 6 — Cyclic Sort / Index Mapping


LeetCode Pattern:

 Missing / duplicate numbers


HackerRank Word Problems:

1. Missing Numbers ⭐
2. Permutation Equation

3. Sequence Equation

📌 What they teach:


 Index-based placement logic

 Rearrangement thinking

🟢 Pattern 7 — Binary Search on Arrays

LeetCode Pattern:
 Rotated array search

 Binary search on answer

HackerRank Word Problems:

1. Sherlock and Array

2. Radio Transmitters ⭐

3. Minimum Loss
📌 What they teach:

 Search optimization
 Binary decision space

⚫ Pattern 8 — Greedy + Advanced Thinking

LeetCode Pattern:
 Candy

 Jump Game

 Interval logic

HackerRank Word Problems:

1. Candies ⭐

2. Luck Balance
3. Mark and Toys

4. Greedy Florist ⭐

📌 What they teach:

 Greedy decisions
 Cost minimization / maximization

🎯 HIGH-VALUE WORD PROBLEMS (MUST DO ⭐)

If you want maximum placement benefit, prioritize:

 Array Manipulation

 Pairs
 Ice Cream Parlor

 Radio Transmitters
 Candies

 Greedy Florist

 The Maximum Subarray

These are classic Infosys / TCS / Accenture / Cognizant level.


Complete ARRAY Quick Revision Sheet (With LeetCode Numbers)

🎯 Goal: Cover all array patterns in minimum questions


Total: 25 Questions → 100% coverage

🟢 Pattern 1 — Basic Implementation + Traversal

1. LC 1920 – Build Array from Permutation


2. LC 1480 – Running Sum of 1d Array

3. LC 1929 – Concatenation of Array

4. LC 26 – Remove Duplicates from Sorted Array

5. LC 283 – Move Zeroes

🟢 Pattern 2 — Prefix Sum + Subarray Sum


6. LC 303 – Range Sum Query – Immutable

7. LC 560 – Subarray Sum Equals K


8. LC 525 – Contiguous Array

9. LC 724 – Find Pivot Index

🔵 Pattern 3 — Two Pointers

10. LC 167 – Two Sum II (Sorted Array)

11. LC 11 – Container With Most Water

12. LC 15 – 3Sum

13. LC 42 – Trapping Rain Water

🟢 Pattern 4 — Sliding Window

14. LC 209 – Minimum Size Subarray Sum

15. LC 3 – Longest Substring Without Repeating Characters

16. LC 1004 – Max Consecutive Ones III

17. LC 904 – Fruit Into Baskets

🟢 Pattern 5 — Kadane + Subarray Maximum

18. LC 53 – Maximum Subarray


19. LC 152 – Maximum Product Subarray

🔴 Pattern 6 — Cyclic Sort / In-place Rearrangement

20. LC 268 – Missing Number


21. LC 287 – Find the Duplicate Number

22. LC 448 – Find All Numbers Disappeared in an Array

🟢 Pattern 7 — Binary Search on Array

23. LC 33 – Search in Rotated Sorted Array

24. LC 153 – Find Minimum in Rotated Sorted Array

⚫ Pattern 8 — Greedy / Advanced Thinking


25. LC 135 – Candy

You might also like