2025 Jan OPPE 2 - Set 3¶
Extract Border Elements from a List
Return the first and last elements as a list, handling empty and single-element edge cases. Covers arr[-1], if not arr, and always returning a list.
Absolute Time Difference
Find the absolute difference between two HH:MM time strings, returned in the same format. Covers conversion to total minutes, divmod, and {val:02} zero-padding.
Transfer Amount Between Accounts
In-place account balance transfer with three-condition validation. Covers existence check before balance check, short-circuit and, and atomic dict updates.
Words with Consecutive Identical Letters
Filter words that contain at least one repeated adjacent letter. Covers zip(w, w[1:]) for adjacent pairs, any() short-circuiting, and case-insensitive comparison.
Hand Cricket Match Runs
Simulate a hand cricket innings with two out conditions. Full I/O - covers tracking prev_bat across balls, the bat==0 bowler-runs rule, and counting the out ball.
Polygon Analysis
Four geometric functions - perimeter, bounding box, area (Shoelace), and convexity check. Covers modular indexing % n, det_2x2, zcross, and the Shoelace formula.
Total Size of Image Files
Sum file sizes for image extensions from a comma-separated file. File I/O → stdout - covers rsplit(".", 1), .lower() for case-insensitivity, and set membership for O(1) lookup.