LeetCodechevron_rightSolve patternschevron_rightarray string
schemaReusable solving pattern

array string Pattern

Pattern hubs are for building transferable solving frames. Learn the recognition signals first, then drill state definition, update rules, and edge explanation until the pattern feels stable.

database49 problemstune24/18/7 difficulty mixcategory6 linked topics

Pattern brief

Recognize first

Do you understand how to handle edge cases like when there is no common prefix?

Solve rhythm

State the active state and invariant first, explain how each update preserves them, then pressure-test with counterexamples.

Most common miss

Failing to handle the case where no common prefix exists, returning an empty string instead of a valid result.

Recognition signals

  • Do you understand how to handle edge cases like when there is no common prefix?
  • Can you describe the trade-offs between vertical scanning and horizontal scanning?
  • Able to explain space distribution in detail.

Solve flow

  1. 1. Define the active state/window.
  2. 2. Update state while preserving invariants.
  3. 3. Validate with edge-heavy examples.

Common misses

  • Failing to handle the case where no common prefix exists, returning an empty string instead of a valid result.
  • Incorrectly distributing spaces when the number of spaces doesn't divide evenly.
  • Not using bitwise operations correctly, leading to inefficient comparisons or incorrect results.

Recommended Ladder

Problem bank

array string pattern bank

Start by scanning with search or difficulty filters, then narrow by linked topics. The bank continues loading inside its own container so the page stays readable.

Progressive pattern bank

Use it to build pattern understanding first, then expand into the full corpus.

hourglass_bottomScroll inside to continue
search
tuneDifficulty
categoryTopic focus

Showing 24 / 49 problems

+24 per load
#TitleDifficulty
14

Longest Common Prefix

Find the longest common prefix in an array of strings, returning an empty string if none exists.

Easy
68

Text Justification

Text Justification requires packing words into lines to match a specified width, ensuring even distribution of spaces.

Hard
318

Maximum Product of Word Lengths

The problem requires finding the maximum product of lengths of two words from an array, where the words don't share comm…

Medium
722

Remove Comments

Remove comments from a given C++ program source array, handling line and block comments.

Medium
806

Number of Lines To Write String

Calculate how many lines are needed to write a string given individual letter widths, constrained to 100 pixels per line…

Easy
848

Shifting Letters

Given a string and a shift array, shift the first i+1 letters of the string as specified in the array.

Medium
937

Reorder Data in Log Files

Reorder Data in Log Files requires sorting letter-logs lexicographically while keeping digit-logs in original order for …

Medium
944

Delete Columns to Make Sorted

The 'Delete Columns to Make Sorted' problem asks to remove unsorted columns from a string array, ensuring all columns ar…

Easy
990

Satisfiability of Equality Equations

Determine if it's possible to assign values to variables such that all equations are satisfied based on equality and ine…

Medium
1032

Stream of Characters

Implement a StreamChecker that detects if any suffix of a character stream matches a given list of words using efficient…

Hard
1233

Remove Sub-Folders from the Filesystem

Remove sub-folders in a filesystem by filtering out folders nested inside other folders.

Medium
1324

Print Words Vertically

Transform a string into vertical columns by arranging each word character in array positions while trimming trailing spa…

Medium
1408

String Matching in an Array

Identify all strings in an array that appear as substrings of other strings, focusing on array and string matching patte…

Easy
1528

Shuffle String

Reorder characters in a string using a given indices array to reconstruct the intended output efficiently and correctly.

Easy
1629

Slowest Key

Determine which key had the longest press duration in a sequence using array indices and string mapping, resolving ties …

Easy
1662

Check If Two String Arrays are Equivalent

Determine if two string arrays form identical strings by concatenating elements in order, handling subtle array-length m…

Easy
1769

Minimum Number of Operations to Move All Balls to Each Box

Solve the problem of finding the minimum operations to move balls to each box using an efficient approach with arrays an…

Medium
1773

Count Items Matching a Rule

Count Items Matching a Rule is an easy problem that tests array and string manipulation with conditions based on specifi…

Easy
1816

Truncate Sentence

Truncate a sentence to contain only the first k words by converting it into an array of words.

Easy
1967

Number of Strings That Appear as Substrings in Word

Count how many strings in an array appear as substrings within a given word by checking each pattern individually.

Easy
1985

Find the Kth Largest Integer in the Array

This problem asks to find the kth largest integer in an array of string numbers, highlighting sorting and string-based c…

Medium
2011

Final Value of Variable After Performing Operations

Compute the final value of X by simulating each string operation in the array sequentially with careful tracking.

Easy
2114

Maximum Number of Words Found in Sentences

Find the maximum number of words in a single sentence from an array of sentences using array and string processing techn…

Easy
2185

Counting Words With a Given Prefix

Count how many words in a list start with a given prefix.

Easy

swap_vertScroll inside the bank to auto-load more

Continue by topic

Once the pattern itself feels familiar, move back into concrete topic hubs so you can separate the pattern from the changing problem context.

route

Guided Practice Path

AI recommends problems by your level and tracks your progress.

Start Guided Patharrow_forward
Array plus String LeetCode Pattern: 49 Solutions