All Posts

Leetcode 398: Random Pick Index

Given an integer array nums with potential duplicates, you need to randomly select an index i where nums[i] == target. If there are multiple indices with the same value, the selection should be made with equal probability for each valid index.

Leetcode 400: Nth Digit

You are given a positive integer n. Your task is to find the nth digit in an infinite sequence of consecutive integers starting from 1. The sequence starts as [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, …].

Leetcode 415: Add Strings

Given two non-negative integers represented as strings, return the sum of these numbers as a string. The solution should avoid converting the strings to integers directly or using any built-in libraries for large integers.

Leetcode 423: Reconstruct Original Digits from English

You are given a string representing an out-of-order English representation of digits from 0 to 9. Your task is to rearrange the characters of the string in such a way that you can extract the digits in ascending order. The string will only contain valid letters corresponding to the English representations of digits.

Leetcode 445: Add Two Numbers II

You are given two non-empty linked lists where each node contains a single digit representing a non-negative integer. Add the two numbers and return the sum as a linked list, ensuring the most significant digit is at the head of the list.

Leetcode 447: Number of Boomerangs

You are given n distinct points in the 2D plane. A boomerang is defined as a tuple of three points (i, j, k) where the distance between points i and j equals the distance between points i and k. Count the total number of boomerangs that can be formed from the given points.