This question evaluates proficiency in frequency analysis and sorting with tie-breaking by character code, two-pointer pair-sum techniques, deduplication strategies, and algorithmic time and space complexity analysis within the Coding & Algorithms domain.
Task 1 — Frequency-based string reorder: Given a string s containing ASCII characters, return a new string whose characters are ordered by decreasing frequency; when two characters share the same frequency, order them by ascending character code. Describe your chosen data structures and provide time and space complexity. Task 2 — All unique two-sum pairs in sorted array: Given a nondecreasing sorted integer array nums and an integer target, return all unique index pairs (i, j) with i < j such that nums[i] + nums[j] == target. Avoid duplicate pairs when values repeat. Achieve O(n) time and O(