Single or Double Linear Scan

A suitable name for an algorithm or process that involves making one or two passes through a data structure (like an array) from left to right or right to left could be a “Single or Double Linear Scan.”

Here’s why this name is appropriate:

  • Single or Double: This part of the name indicates that the process can involve either one or two passes, depending on the situation or requirements.

  • Linear Scan: This term describes the process of iterating through the data structure in a linear fashion, either from the beginning to the end (left to right) or from the end to the beginning (right to left).

Together, “Single or Double Linear Scan” concisely conveys the key characteristics of the process.

#NumberName
153Maximum Subarray
2121Best Time to Buy and Sell Stock.
3152Maximum Product Subarray
4238Product of Array Except Self
5739Daily Temperatures
6769Max Chunks to Make Sorted
7768Max Chunks to Make Sorted II
8821Shortest Distance to a Character
9845Longest Mountain in Array
10581Shortest Unsorted Continuous Subarray
11896Monotonic Array

3-pass: 42. Trapping Rain Water