LeetCode 2089: Find Target Indices After Sorting Array ACERS Guide

Subtitle / Summary This problem is a useful bridge between sorting and binary search. After sorting the array, all copies of target become one contiguous block, and the answer is simply every index inside that block. Reading time: 10-12 min Tags: sorting, binary search, range location SEO keywords: Find Target Indices After Sorting Array, LeetCode 2089, lower bound, upper bound Meta description: Sort the array, use lower and upper bounds to find the target block, and return every matching index, with tradeoffs, engineering scenarios, and runnable implementations in six languages. Target Readers Learners connecting sorting with lower/upper bound search Engineers who need all positions of one value after offline sorting Interview candidates reviewing how contiguous blocks form in sorted data Background / Motivation The input array is not sorted, so we cannot apply binary search immediately. But once we sort it, every copy of the same value becomes one continuous segment. ...

March 18, 2026 · 8 min · map[name:Jeanphilo]

Sorting Series (Final): Practical Selection - Choose by Scale, Stability, Memory, Distribution

Practical selection guide: decision tables by scale/distribution/stability/memory, engineering scenarios, test checklist, and common pitfalls to apply the series.

December 9, 2025 · 4 min · map[name:Jeanphilo]

Sorting Series (8): TimSort and Introsort - Engineering Patterns Behind Built-in Sorts

Explain Python/Java TimSort and C++ std::sort Introsort: triggers, stability, complexity, trade-offs, with skeletons and selection guidance.

December 8, 2025 · 5 min · map[name:Jeanphilo]

Sorting Series (7): Non-Comparison Sorting - Counting, Bucket, Radix and the Range/Digit Tradeoff

Explain prerequisites, complexity, implementation details, and pitfalls of non-comparison sorts with multilingual examples for counting, bucket, and radix.

December 7, 2025 · 5 min · map[name:Jeanphilo]

Sorting Series (6): Heap Sort - In-place O(n log n) with Worst-Case Guarantees

Explain heap sort principles, complexity, and engineering scenarios; compare with quick/merge; include multilingual implementations and top-k examples.

December 6, 2025 · 5 min · map[name:Jeanphilo]

Sorting Series (5): Quick Sort - Pivot Strategy, Tail Recursion, Engineering Practice

Comprehensive quicksort guide: pivot selection, three-way partitioning, tail recursion optimization, hybrid sorting practices, with multilingual implementations and engineering guidance.

December 5, 2025 · 8 min · map[name:Jeanphilo]

Sorting Series (4): Merge Sort - Stable Divide and Conquer and External Sorting

Systematic explanation of merge sort principles, stability, space trade-offs, and engineering scenarios with Python/C/C++/Go/Rust/JS implementations and external sorting guidance.

December 4, 2025 · 10 min · map[name:Jeanphilo]

Sorting Series (3): Shell Sort - From Insertion to Gap-Based Efficiency

Explain Shell sort principles, gap strategies, and engineering usage with scenarios and Python/C/C++/Go/Rust/JS implementations.

December 3, 2025 · 7 min · map[name:Jeanphilo]

Sorting Series (2): Bubble, Selection, Insertion - Three O(n^2) Baselines

Systematic ACERS explanation of bubble/selection/insertion sorts: principles, stability, scenarios, and multilingual implementations with selection guidance.

December 2, 2025 · 7 min · map[name:Jeanphilo]

Sorting Series (1): How to Choose an Algorithm - Time, Space, Stability, Scenarios

Use the ACERS template to map common sorting algorithms by scenario, complexity, stability, and engineering usage, with runnable examples and a selection checklist.

December 1, 2025 · 6 min · map[name:Jeanphilo]