SMU Summer 2024 Contest Round 4 - Problem Editorials

Made Up Problem Statement Given three sequences A, B, C, count the number of pairs (i, j) such that A[i] = B[C[j]]. Solution Approach Since all values are bounded between 1 and N, we can use frequency counting. For each value v, count how many times it appears in array A (stored in cntA) and how many times it appears as B[C[j]] (stored in cntB) ...

Posted on Thu, 04 Jun 2026 16:57:11 +0000 by reyes99

Maximum Bitwise OR After K Doubling Operations

Problem Statement Given a integer array nums of length n (0-indexed) and an integer k, you may perform the following operation at most k times: Select any element and multiply it by 2 Return the maximum value of nums[0] | nums[1] | ... | nums[n - 1], where a | b denotes the bitwise OR operation. Examples: Example 1: Input: nums = [12,9], k = ...

Posted on Mon, 18 May 2026 21:53:55 +0000 by opels

Tree Visibility Problem: Maximum Trees Visible Through a Telescope Window

Problem Description Consider a road that is 20 meters long with tree pits located every 1 meter. The tree pits are numbered from left to right as 0, 1, 2, ..., 20. Some of these pits contain trees, with each pit holding at most one tree. A person is standing at a window with a telsecope and can observe exactly 4 consecutive tree pits at a time ...

Posted on Mon, 11 May 2026 09:41:26 +0000 by fasmy98

Weekly Contest 357 Solutions

Problem 2810 - Faulty Keeyboard Simulate the keyboard behavior as described. When encuontering character 'i', reverse the current string. class Solution { public: string finalString(string input) { string result = ""; for(char c : input) { if(c == 'i') { reverse(result.begin(), ...

Posted on Sun, 10 May 2026 02:00:36 +0000 by stone