Implementing Efficient String and Array Algorithms in Java
Manacher's Algorithm for Longest Palindromic Substring
Identifying the longest palindromic substring within a string requires handling both odd and even-length palindromes. A common approach involves expanding from each center, but this method fails to detect even-length palindromes. The solution is to insert a delimiter character between each ...
Posted on Fri, 08 May 2026 21:08:24 +0000 by erichar11
SMU Summer 2024 Contest Round 8 - Problem Solutions
SMU Summer 2024 Contest Round 8 - Problem Solutions
Problem 1: Product
Approach Observing that the constraint \(\prod_{i=1}^N L_i \le 10^5\) implies that N cannot exceed 16, since \(2^{17} > 10^5\). This allows us to solve the problem using straightforward brute force enumeration of all possible combinations.
Implementation
#include <bits ...
Posted on Fri, 08 May 2026 18:23:22 +0000 by apulmca
NowCoder 2024 Multi-University Contest Round 1: Problem Set Analysis
The contest comprised 11 problems with varying difficulty levels based on technical depth:
High Solvability (8/11): Problems A, B, C, D, H, I, J, K generally follow standard patterns.
Low Solvability (3/11): E, F, G involve complex nested algorithms or obscure insights.
The following sections detail the solutions for the most instructive prob ...
Posted on Fri, 08 May 2026 13:20:15 +0000 by gwh
Binary Tree Traversals: Recursive and Iterative Approaches
1. Binary Tree Categories
Full Binary Tree: A binary tree where all nodes have either 0 or 2 children, and all leaf nodes are at the same level. For depth k, the tree contains (2^k - 1) nodes.
Complete Binary Tree: A binary tree where all levels except possibly the last are completely filled, and all nodes are as far left as possible.
Binary Se ...
Posted on Fri, 08 May 2026 11:22:02 +0000 by jtbaker
Merging Sorted Arrays in JavaScript
Given two sorted integer arrays nums1 and nums2 in non-decreasing order, with lengths m and n respectively, merge them into nums1 while maintaining sorted order.
Implementation Code
function merge(nums1, m, nums2, n) {
let i = nums1.length - 1;
m--;
n--;
while(n >= 0) {
while(m >= 0 && nums1[m] > nums2[n ...
Posted on Thu, 07 May 2026 23:17:39 +0000 by hinz
Algorithmic Paradigms and Optimizations in Competitive Programming
Probabilistic Path Enumeration in Directed Acyclic Graphs
Given a directed acyclic graph (DAG) consisting of $V$ vertices and $E$ edges, each edge $e_k$ possesses an independent activation probability $p_k$. The objective is to compute the expected number of functional paths originating from vertex $0$ and terminating at vertex $V-1$. A path is ...
Posted on Thu, 07 May 2026 22:27:40 +0000 by PDP11
Editorial and Analysis for 2024 ICPC Network Preliminary Round 2
Competition Overview
The problem difficulty is generally estimated as F < A = J = I < L = G = E < C = K = H. The contest featured a mix of standard algorithms and optimization problems. Below is the detailed analysis and solution for each problem.
Problem F: Prefix Sum Threshold
Problem Statement:Given an initial score of 1500 and a sequence o ...
Posted on Thu, 07 May 2026 20:53:12 +0000 by EGNJohn
Efficient Solutions for Word Search II Problem
Given an m x n board of characters and a list of strings words, return all words on the board.
Each word must be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word.
1. Trie with DFS
Build a trie from the given wor ...
Posted on Thu, 07 May 2026 19:06:04 +0000 by Lassie
Stack and Queue Data Structure Problems in C++
Stack and Queue in C++ STL
The C++ Standard Library provides implementations of both stack and queue data structures. These are fundamental containers that follow specific access orders—LIFO (Last In, First Out) for stacks and FIFO (First In, First Out) for queues.
Stack Interface
push(element): Inserts an element at the top
pop(): Removes the ...
Posted on Thu, 07 May 2026 15:47:20 +0000 by Rado001
Calculating the Length of the Longest Substring Without Repeating Characters
Given a string, identify the length of its longest contiguous substring containing no duplicate cahracters.
Example 1:
Input: "abcabcbb"
Output: 3
Explanation: The longest substring without repeating characters is "abc", which has a length of 3.
Example 2:
Input: "bbbbb"
Output: 1
Explanation: The longest substrin ...
Posted on Thu, 07 May 2026 14:57:56 +0000 by rmbarnes82