2026 Jan OPPE 1 - Set 2¶
String Repeated Thrice
Check if a string is made of the same substring repeated exactly 3 times. Covers part * 3 == s and chained equality.
Sum of Ends Divisible by K
Check if the sum of first and last tuple elements is divisible by k. Covers nums[-1] and the modulo divisibility check.
Move Even Indices to End Reversed
Rearrange a tuple - odd-indexed elements first, then even-indexed reversed. Covers step slicing t[0::2] and [::-1].
Largest Zero Sum Subarray
Find the longest contiguous subarray summing to zero. Covers the prefix sum hash map trick and the {0: -1} sentinel.
Group and Sum Values by Key
Parse key:value lines, accumulate totals per key, print sorted. Full I/O - covers dict.get(key, 0) and defaultdict.
Flight Records Analysis
Five functions on flight data - on-time rate, most delayed route, busiest airport, total delay hours, summary dict. Covers Counter, setdefault(), and max(key=).
Zigzag Number Grid
Print an n×n grid alternating left-to-right and right-to-left rows. Full I/O - covers i % 2 direction control and print(*iterable).