LeetCodechevron_rightSolve patternschevron_rightarray math
schemaReusable solving pattern

array math 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.

database111 problemstune31/50/30 difficulty mixcategory6 linked topics

Pattern brief

Recognize first

Focus on in-place array manipulation rather than creating a new matrix.

Solve rhythm

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

Most common miss

Trying to rotate using an extra matrix, which violates in-place constraint.

Recognition signals

  • Focus on in-place array manipulation rather than creating a new matrix.
  • Check if candidate uses both transpose and row reversal, showing understanding of index math.
  • Can the candidate handle the carry and array resizing efficiently?

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

  • Trying to rotate using an extra matrix, which violates in-place constraint.
  • Forgetting to handle carry-over when incrementing digits.
  • Attempting to divide every number by all smaller numbers instead of using a sieve.

Recommended Ladder

Problem bank

array math 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 / 111 problems

+24 per load
#TitleDifficulty
48

Rotate Image

Rotate an n x n matrix 90 degrees clockwise in-place using array manipulation and mathematical indexing techniques effic…

Medium
66

Plus One

Given a number as an array of digits, increment it by one and return the updated array of digits.

Easy
204

Count Primes

Count all prime numbers less than a given integer n using efficient array and math-based enumeration techniques.

Medium
335

Self Crossing

Determine if a path defined by sequential distances on a 2D plane crosses itself using array and math reasoning.

Hard
384

Shuffle an Array

Shuffle an Array requires designing a class to randomly permute an integer array while ensuring all permutations are equ…

Medium
453

Minimum Moves to Equal Array Elements

Compute the fewest steps to make all elements equal by incrementing n-1 array items, applying array and math reasoning.

Medium
462

Minimum Moves to Equal Array Elements II

Find the minimum moves to equalize all array elements using increments or decrements with array and math techniques.

Medium
477

Total Hamming Distance

Calculate the total Hamming distance between all pairs in an integer array using efficient bit manipulation techniques.

Medium
539

Minimum Time Difference

Calculate the smallest time difference between clock points using array manipulation and mathematical conversions effici…

Medium
587

Erect the Fence

Find the perimeter fence of a garden by determining the outermost trees in a set of given tree coordinates.

Hard
598

Range Addition II

Range Addition II requires counting maximum values in a matrix after incremental operations using array and math reasoni…

Easy
628

Maximum Product of Three Numbers

Find three numbers in an array whose product is the largest using sorting and careful handling of negative values.

Easy
667

Beautiful Arrangement II

Construct a beautiful arrangement of integers from 1 to n with k distinct integers, optimizing for time and space effici…

Medium
775

Global and Local Inversions

Determine if every global inversion in a permutation array is also a local inversion using array and math logic efficien…

Medium
782

Transform to Chessboard

Determine the minimum swaps of rows or columns to convert an n x n binary board into a valid chessboard configuration.

Hard
789

Escape The Ghosts

Escape The Ghosts tests your ability to analyze movements in an infinite grid while racing against ghost positions using…

Medium
810

Chalkboard XOR Game

The Chalkboard XOR Game is a game theory problem involving array manipulation and bitwise XOR, where players alternate e…

Hard
812

Largest Triangle Area

Find the area of the largest triangle formed by three distinct points on a 2D plane.

Easy
843

Guess the Word

Master the Guess the Word problem by applying array manipulation, match-counting math, and strategic interactive guessin…

Hard
883

Projection Area of 3D Shapes

Calculate the projection area of a 3D shape defined by a grid of towers with varying heights.

Easy
891

Sum of Subsequence Widths

Calculate the sum of widths for all subsequences in an integer array using sorting and combinatorial math efficiently.

Hard
892

Surface Area of 3D Shapes

Solve the Surface Area of 3D Shapes problem using array manipulation and mathematical formulas to calculate surface area…

Easy
908

Smallest Range I

Find the smallest score of an array after applying an operation to each element within a given range.

Easy
927

Three Equal Parts

Divide a binary array into three contiguous parts such that each part represents the same integer value in binary, using…

Hard

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 Math LeetCode Pattern: 111 Solutions