Grouping Anagrams Using Sorted Strings as HashMap Keys
---------------🎈🎈 LeetCode Problem 49: Group Anagrams 🎈🎈-------------------
In Java, arrays cannot be used directly as keys in a HashMap because their hashCode() method does not reflect the actual content. It is therefore recommended to use immutable objects such as strings as keys.
Approach 1: Use a Sorted String as the Key
⭐️ Since two ...
Posted on Fri, 18 Sep 2026 16:20:45 +0000 by ckwall
String Input Functions in C: gets(), fgets(), and gets_s()
Allocating Memory for String Input
Before reading a string, sufficient memory must be allocated to store it. The compiler does not automatically allocate space based on input length.
Incorrect approach:
char *ptr;
scanf("%s", ptr); // ptr is uninitialized, leading to undefined behavior.
Correct approach:
char buffer[100];
scanf(" ...
Posted on Tue, 15 Sep 2026 16:50:03 +0000 by leeharvey09
Bulb Switcher IV Solution
Problem Analysis
Given a target string of '0's and '1's representing the desired state of bulbs, the goal is to determine the minimum number of flips required to transform an initial state of all '0's to the target state. Each flip operation selects a bulb at position i and flips all bulbs from i to the end of the array.
Key Insight
The problem ...
Posted on Fri, 04 Sep 2026 16:36:31 +0000 by blr32
Understanding JVM String Constant Pool and String Interning
String Fundamentals and Internal Structure
The String class in Java is declared as final, meaning it cannot be extended. It implements both Serializable and Comparable interfaces, enabling it to support serialization and comparison operations. Prior to Java 8, strings were internally represented using a char[]. Starting from Java 9, this was ch ...
Posted on Thu, 03 Sep 2026 16:45:50 +0000 by subhuman
Finding the Longest Substring Without Repeating Characters
Problem Statement
Given a string, determine the length of the longest contiguous substring that does not contain any repeating characters.
Sliding Window Approach
The sliding window technique maintains a window defined by left and right pointers. As the right pointer expands the window, we track character frequencies. If a duplicate is found, ...
Posted on Sat, 29 Aug 2026 16:12:55 +0000 by fusionxn1
Constructing Lexicographically Minimal Strings with Minimized Maximum Prefix Borders
Given a string $s$, the goal is to find a permutation $t$ such that the maximum value of the border length $f(i)$ across all prefixes $i$ of $t$ is minimized. Among all permutations that achieve this minimum, $t$ must be the lexicographically smallest.
Character Analysis and Minimum Border Criteria
For any string containing at least two distinc ...
Posted on Tue, 18 Aug 2026 16:21:49 +0000 by shoz
Redis Data Types: An In-depth Guide to String and Hash Structures
Before diving into Redis's five fundamental data structures, it's essential to understand some core concepts that will provide a solid foundation for the following content. These include Redis's global commands, internal data structure encoding mechanisms, and its single-threaded command processing approach.
Redis Global Commands
Keys Command
T ...
Posted on Sat, 15 Aug 2026 16:37:50 +0000 by psychomossel
Python Built-in Data Types Explained
Python supports a variety of built-in data types that allow developers to store and manipulate different kinds of information. These include numeric types, text sequences, boolean values, sequecnes, sets, mappings, and binary data.
Numeric Types
Python's numeric category primarily consists of integers (int), floating-point numbers (float), and ...
Posted on Sat, 08 Aug 2026 16:12:54 +0000 by JNorman
ES6 String Enhancements: Methods, Template Literals, and Tagged Templates
String Methods in ES6
JavaScript strings are based on UTF-16 encoding, where each code unit occupies 2 bytes. Characters within the Basic Multilingual Plane (U+0000 to U+FFFF) fit in one code unit, while supplementary characters require two.
charAt and charCodeAt
charCodeAt returns the UTF-16 code unit at a given index, while charAt returns the ...
Posted on Wed, 05 Aug 2026 16:06:03 +0000 by britt15
Learning the String Type in Rust
What is String
Rust's core language has only one string type, which is the string slice str, usually seen as a borrowed &str.
The String type is provided by the standard library rather than encoded directly into the core language. It is a growable, mutable, UTF-8 encoded type.
Both str and String are UTF-8 encoded. If you need a non-UTF-8 ...
Posted on Sun, 26 Jul 2026 16:50:50 +0000 by lucerias