Fundamentals of Algorithm Analysis: Time Complexity, Binary Search, and Pointer Techniques
Time Complexity Calculation
The core concept involves determining the relationship between loop iterations and execution count. For nested loops, analyze the inner loop's operations relative to the outer loop's progression, then sum these operasions at critical bounds (often forming arithmetic or geometric series).
Binary Search Implementation
...
Posted on Wed, 28 Oct 2026 16:08:26 +0000 by chuckwgn
Core Array Algorithms: Efficient Searching, Filtering, and Transformation Techniques
Fundamental Memory Layout
Arrays store elements in contiguous memory regions, enabling constant-time indexing. While single-dimensional arrays guarantee sequential placement, multidimensional arrays in certain programming languages do not ensure row-to-row continuity. This distinction directly influences cache locality and pointer arithmetic st ...
Posted on Mon, 26 Oct 2026 16:48:25 +0000 by centenial
Finding the Start of a Cycle in a Linked List
Given the head node of a linked list, return the node where a cycle begins. If no cycle exists, return null. The linked list cannot be modified.
A cycle is present if a node can be reached again by continuously following the next pointer. The evaluation system internally uses an integer pos to denote the zero-based index where the tail connects ...
Posted on Wed, 21 Oct 2026 16:53:26 +0000 by DjMikeS
Detecting the Intersection Node of Two Linked Lists with Two Pointers
Problem OverviewGiven the head pointers of two singly linked lists, the objective is to locate the node where the two lists merge. The solution must identify the first common node shared by both lists. If no intersection exists, the function should return null. The constraints require O(1) auxiliary space and O(N+M) time complexity, without mod ...
Posted on Wed, 21 Oct 2026 16:25:35 +0000 by ac1982
Solving LeetCode 977: Squares of a Sorted Array Using Two Pointers
LeetCode 977 – Squares of a Sorted Array
Algorithm: Two‑pointers
After squaring, the largest numbers are at the two ends of the array, while the smallest numbers gather in the middle. This naturally suggests using a pointer at the start and a pointer at the end.
Modifying the original array in place can accidentally overrwite elements that hav ...
Posted on Wed, 07 Oct 2026 16:07:39 +0000 by vandalite
Finding the K Strongest Values in an Array
Given an integer array `arr` and an integer `k`, the goal is to identify the `k` strongest values. The strength of an element is determined by its absolute difference from the array's median.
Let `m` be the median of the array. An element `arr[i]` is considered stronger than `arr[j]` if either condition is met:
`|arr[i] - m| > |arr[j] - m|`
...
Posted on Fri, 02 Oct 2026 16:14:10 +0000 by Cleanselol
Optimizing String and Array Problems with Greedy Algorithms and Data Structures
Problem 1: Lexicographical String Matching
Solution
Since the problem involves lexicographical order, a trie data structure is suitable.
To find the solution, use a greedy approach. Determine if the string ending at the current node is the answer. If not, continue to traverse to one of the child nodes. The process is illustrated in the followi ...
Posted on Wed, 02 Sep 2026 16:37:10 +0000 by corbin
Two Sum II - Input Array Is Sorted
You are given a 1-indexed array of integers numbers that is already sorted in non-decreasing order. Find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2] where 1 <= index1 < index2 <= numbers.length.
Return the indices of the two numbers, index1 and index2, as a ...
Posted on Tue, 25 Aug 2026 16:09:18 +0000 by scoman
Algorithmic Techniques for Common LeetCode Problems
Single Number
Given a non-empty array of integers where every element appears twice except for one, find that single one using bitwise XOR.
The XOR operation has two critical properties: commutativity (a ^ b == b ^ a) and identity (x ^ x == 0 and x ^ 0 == x). Consequently, XORing all numbers in the array cancels out the pairs, leaving the uniqu ...
Posted on Sat, 15 Aug 2026 16:45:20 +0000 by healthbasics
Counting Segments After Cutting a Sequence Based on a Given Set
Problem
We are given a sequence (a_1, a_2, \ldots, a_n) of length (n) and (m) distinct integers (b_1, b_2, \ldots, b_m). We perform a fierce cut on sequence (a) based on the numbers in (b). Specifical, for each position (i) where (a_i) equals some (b_j), we remove the element at that position, splitting the current sequence/fragment into two fr ...
Posted on Sun, 09 Aug 2026 16:28:13 +0000 by ashebrian