Skip to content

2025 Jan OPPE 2 - Set 3

Section 1 · Question 1

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.

Solved
Section 1 · Question 2

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.

Solved
Section 1 · Question 3

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.

Solved
Section 2 · Question 1

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.

Solved
Section 2 · Question 2

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.

Solved
Section 3 · Question 1

Polygon Analysis

Four geometric functions - perimeter, bounding box, area (Shoelace), and convexity check. Covers modular indexing % n, det_2x2, zcross, and the Shoelace formula.

Solved
Section 3 · Question 2

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.

Solved