This multi-part question evaluates string and array manipulation, in-place algorithm implementation, combinatorial subset generation with and without duplicate handling, and calendar date arithmetic, testing competencies in algorithm design, complexity analysis, and edge-case handling within the Coding & Algorithms domain and requiring both conceptual understanding and practical implementation skills. Such problems are commonly asked in technical interviews to gauge a candidate's ability to implement efficient algorithms, reason about permutations and deduplication, manage memory constraints for in-place operations, and correctly handle date calculations and input edge cases.
You are asked to solve multiple coding tasks.
s
containing words separated by spaces (may contain leading/trailing spaces and multiple spaces between words).
" the sky is blue " -> "blue is sky the"
Follow-up: If the input is a mutable character array (e.g., char[]), modify it in place (O(1) extra space) to achieve the same result.
nums
where all elements are distinct.
nums
that may contain duplicates.
date1
and
date2
in the format
YYYY-MM-DD
.