Longest Common Substring Using Hashing
The problem involves finding the longest common substring between two strings composed solely of lowercase letters. The string lengths can reach up to 250,000.
The solution uses binary search combined with hashing techniques to efficiently determine the maximum length of the shared substring.
Let's denote the two input strings as $ s_1 $ and $ ...
Posted on Sat, 06 Jun 2026 17:48:41 +0000 by HuggyBear
Array Repetition: Efficient Query Resolution for Dynamic Expansion Operations
Problem Overview
Given an empty array a, perform n operations of two types:
Type 1: Append a number x (1 ≤ x ≤ n) to the array.
Type 2: Replicate the current array x times (1 ≤ x ≤ 10^9) and append the copies.
After all operations, q queries ask for the value at position k (1-indexed). Constraints: n, q ≤ 10^5, and 1 ≤ k ≤ min(10^18, final_ar ...
Posted on Wed, 03 Jun 2026 18:12:25 +0000 by mastercjb
Binary Search Optimization for Fractional Programming Problems with Length Constraints
Binary Search Applications in Fractional Programming
Consider an optimization problem where we seek the maximum average value over subarrays of minimum length. Given array elements $a_1, a_2, ..., a_n$ and minimum length constraint $L$, we want to find:
$$\max_{\substack{1 \leq i \leq j \leq n \ j - i + 1 \geq L}} \frac{\sum_{k=i}^{j} a_k}{j - ...
Posted on Thu, 28 May 2026 22:48:55 +0000 by Madatan
Binary Search Algorithm Deep Dive
Binary Search Fundamentals
Problem Statement
Given a sorted array of n integers in ascending order and a target value, implement a function that searches for the target in the array. Return the index if the target exists, otherwise return -1.
Constraints:
All elements in the array are unique
n ranges from [1, 10000]
Each element falls within [ ...
Posted on Mon, 18 May 2026 07:53:59 +0000 by sgoku01
Array Manipulation Techniques in C++
Binary Search Implementation
Element Removal Optimization
Sorted Squares Generation
Spiral Matrix Construction
Binary Search Implementation
Binary seearch implementation requires careful consideration of boundary conditions:
Loop condition: left < right vs left <= right
Right boundary update: right = middle vs right = middle ...
Posted on Sat, 16 May 2026 15:05:13 +0000 by hiprakhar
Optimizing Array Pair Products for Maximum Sum
Problem Analysis and Solution
Given two arrays, the goal is to pair elements from each array to maximize the sum of their products. Since positive multiplied by positive yields positive, and negative multiplied by negative also yields positive, we can seperate both arrays into positive and negative components.
The optimal strategy is to pair la ...
Posted on Fri, 15 May 2026 16:12:07 +0000 by iBuddy
Practical Applications of Binary Search and Fractional Programming
Binary search is a fundamental algorithm with applications in various computational problems. The key considerations when implementing binary search include identifying the search target, determining search boundaries, and designing the validation function.
Music Notes Timing Analysis
Determine the number of songs played within a given time fra ...
Posted on Wed, 13 May 2026 19:18:36 +0000 by Ghost_81st
Optimal Network Cable Segmentation for Competition Setup
Problem Description
A programming competition is being organized where all participant computers must be connected to a central server using equal-length cables arranged in a star topology. Given a colleciton of network cables of various lengths, the objective is to determine the maximum possible length such that exactly K segments of equal len ...
Posted on Wed, 13 May 2026 01:38:41 +0000 by birwin
SMU Autumn 2023 Round 2 (Div.1+2) - Problem Solutions
C. Chaotic Construction
When the circular track is unwrapped into a linear sequence from 1 to 2n, placing a barrier at position D corresponds to having barriers at both D and D+n on this line. For any query (x, y), we check whether any barrier falls between x and y, or between x and y+n. We maintain a booolean array to track which positions are ...
Posted on Sun, 10 May 2026 16:35:21 +0000 by Gibb Boy
Unconventional Approaches to Dynamic Programming Optimization
DP optimization often feels like an arcane art. The question arises: can anyone actually devise such solutions during a programming contest? (Perhaps I'm still learning this skill.)
The core ideas I've encountered fall into these categories:
When transitioning from state i to i+1, the number of states that change is small, so we can inherit val ...
Posted on Sun, 10 May 2026 08:00:30 +0000 by maxpagels