Efficient Port Traffic Analysis with Sliding Window Technique
Problem Analysis
Given n sequences (n ≤ 1e5) where each contains:
Timestamp t (strict increasing)
Count k (k ≤ 3e5)
k integers
Compute for each sequence x the count of unique integers across all sequences where (tx - t) < 86400 (24 hours in seconds).
Constraints
Partial Score (70pts):
1 ≤ n ≤ 100
Total k ≤ 100
Integer values ≤ 100
Timesta ...
Posted on Wed, 28 Oct 2026 16:48:53 +0000 by andychamberlainuk
Stack and Queue Fundamentals with Practical Implementations
Stack: Last-In-First-Out (LIFO) structure.
Queue: First-In-First-Out (FIFO) structure.
Both are container adaptors in C++ STL, not containers themselves. They rely on underlying containers (like deque, vector, or list) to store data, exposing only a restricted interface—no iterators or traversal methods.
Standard Library Implementations
The C ...
Posted on Mon, 26 Oct 2026 16:36:54 +0000 by Whyme
Queue Fundamentals: Circular Array and Linked Implementations
Core Queue Operations
A queue is a linear data structure that enforces FIFO (First-In-First-Out) ordering. The essential primitives are:
init – create an empty queue
isEmpty – test for emptiness
enqueue – append an element at the rear
dequeue – remove the element at the front
peek – inspect the front element without removal
Circular Buffer Qu ...
Posted on Tue, 20 Oct 2026 16:17:43 +0000 by PHPilliterate
Fundamentals of Stacks and Queues: Core Data Structures for Efficient Data Management
Stacks and Queues
Stacks and queues are fundamental linear data structures used for organizing and managing data in computer science. They provide specific ways to add and remove elements, which makes them suitable for a variety of applications.
Stack
A stack is a linear data structure that follows the Last-In, First-Out (LIFO) principle. This ...
Posted on Sat, 17 Oct 2026 16:45:47 +0000 by kmarsh
Implementing Queue with Stacks and Stack with Queues
Implementing a Queue Using Two Stacks
A queue follows FIFO (First-In-First-Out), while a stack follows LIFO (Last-In-First-Out). To simulate queue behavior using stacks, two stacks are used: one for input (inStack) and one for output (outStack).
Push: Elements are always pushed onto inStack.
Pop/Peek: If outStack is empty, all elements from in ...
Posted on Fri, 16 Oct 2026 16:00:20 +0000 by mosherben
Java Collections Framework Core Interfaces
List Interface
The List interface is a core component of the Java Collections Framework, extending the Collection enterface. It defines operations for ordered collections of elements.
Key Characteristics
Order Preservation: Elements are stored and retrieved in the sequence they were added.
Duplicate Elements: Allows multiple identical elements ...
Posted on Fri, 09 Oct 2026 16:26:19 +0000 by w.geoghegan
Computing Sum of Numbers Along Root-to-Leaf Paths in Binary Tree
Given a binary tree where each node contains a digit (0-9), each root-to-leaf path represents a numerical value. For instance, the path 1 → 2 → 3 corresponds to the number 123.
The task is to calculate the sum of all numbers represented by root-to-leaf paths.
Note: A leaf node is a node with no children.
Example 1
Input: [1,2,3]
1
/ \
...
Posted on Tue, 06 Oct 2026 16:16:57 +0000 by boogybren
Algorithm Practice Day 11: Postfix Expression Evaluation, Sliding Window Maximum, and Top K Frequent Elements
Problem Solving
1.1 Evaluate Reverse Polish Notation
Original Link: Code Suizhanglu
Problem Link: 150. Evaluate Reverse Polish Notation - LeetCode
Description
Given an array of strings tokens represanting a postfix expression, compute the result of this expression. Return an integer representing the value of the expression.
Notes:
Valid oper ...
Posted on Sun, 04 Oct 2026 16:03:09 +0000 by jqa
Algorithm Training Camp Day 9: Implement Queue with Stacks, Stack with Queues, Valid Parentheses, Remove Adjacent Duplicates
232. Implement Queue using Stacks
Problem:
Implement a first-in-first-out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, pop, peek, empty):
Implement the MyQueue class:
void push(int x): Push element x to the back of the queue.
int pop(): Removes the element from the front of ...
Posted on Sun, 27 Sep 2026 16:26:59 +0000 by Atomiku
Process Synchronization with Locks, Queues, Producer-Consumer Pattern, and Threading
Process Synchronization with Locks
Simulating Ticket Booking System with Concurrency
Requirements:
Check available tickets
Purchase tickets
Concurrent Ticket Purchase Leading to Data Corruptoin
import multiprocessing
import time
import json
def check_tickets(user_id):
with open('ticket_data.json', 'r') as file:
data = json.load(f ...
Posted on Sat, 12 Sep 2026 16:56:40 +0000 by napier_matt