pyPython Practice LabFrom first print to final round
TOPIC 14 OF 18

Top Company Arrays, Strings, and Sliding Windows Python practice problems

Company-screen array and string patterns: two pointers, matrices, prefix sums, and sliding windows.

20 exercises8+ conceptsBeginner → interview context
Start this topic
WHAT YOU WILL PRACTISE

Core concepts

Maximize one stock transactionFind unique three-sum tripletsMaximize water between linesCalculate trapped rain waterFind the longest consecutive runRotate a square matrix clockwiseRead a matrix in spiral orderSet matrix rows and columns to zero
REUSABLE THINKING

Problem-solving patterns

  • Move boundaries while preserving a window or two-pointer invariant
INTERVIEW SIGNALS

Reported company tags

AmazonMicrosoftMetaGoogle
Community-reported tags are guidance, not guarantees.
ORDERED PRACTICE

All 20 problems in this topic

Work from top to bottom to build the concept gradually.

  1. #261
    Maximize one stock transaction: Profitable price history

    Find the best profit from exactly one buy followed by one later sale.

    Company MediumPremium
  2. #262
    Maximize one stock transaction: Falling market

    Return zero when no later selling price exceeds an earlier buying price.

    Company MediumPremium
  3. #263
    Find unique three-sum triplets: Two valid triplets

    List all unique triples whose sum is zero.

    Company MediumPremium
  4. #264
    Find unique three-sum triplets: No zero-sum triple

    Report None when no three values can make zero.

    Company MediumPremium
  5. #265
    Maximize water between lines: Mixed container heights

    Find the largest container area formed by two vertical lines.

    Company MediumPremium
  6. #266
    Maximize water between lines: Two-line minimum

    Handle the smallest valid input containing exactly two lines.

    Company MediumPremium
  7. #267
    Calculate trapped rain water: Classic elevation map

    Calculate total water trapped after rain across varied bars.

    Company HardPremium
  8. #268
    Calculate trapped rain water: No basin

    A steadily rising elevation map cannot trap water.

    Company HardPremium
  9. #269
    Find the longest consecutive run: Unsorted run

    Find the length of the longest consecutive sequence without sorting.

    Company MediumPremium
  10. #270
    Find the longest consecutive run: Duplicates inside a run

    Ignore duplicate values while measuring a consecutive sequence.

    Company MediumPremium
  11. #271
    Rotate a square matrix clockwise: Three-by-three image

    Rotate a small image matrix 90 degrees clockwise.

    Company MediumPremium
  12. #272
    Rotate a square matrix clockwise: Two-by-two matrix

    Verify the same in-place transformation on the smallest nontrivial square.

    Company MediumPremium
  13. #273
    Read a matrix in spiral order: Rectangular spiral

    Return a rectangular matrix in clockwise spiral order.

    Company MediumPremium
  14. #274
    Read a matrix in spiral order: Single column

    Avoid duplicate visits when the matrix has only one column.

    Company MediumPremium
  15. #275
    Set matrix rows and columns to zero: One internal zero

    Zero the complete row and column containing an original zero.

    Company MediumPremium
  16. #276
    Set matrix rows and columns to zero: Several original zeros

    Apply all row and column effects from multiple original zeros.

    Company MediumPremium
  17. #277
    Count subarrays with target sum: Repeated target sums

    Count every contiguous subarray whose sum equals the target.

    Company MediumPremium
  18. #278
    Count subarrays with target sum: Include negative values

    Use prefix counts where a sliding window would fail because values may be negative.

    Company MediumPremium
  19. #279
    Find the minimum covering window: Smallest covering substring

    Find the shortest source substring containing every required character with multiplicity.

    Company HardPremium
  20. #280
    Find the minimum covering window: Impossible coverage

    Report None when the source cannot cover the required characters.

    Company HardPremium