All Posts

Leetcode 11: Container With Most Water

You are given an array of integers where each integer represents the height of a vertical line drawn on a 2D plane. The x-axis is represented by the index of the array, and each line’s height corresponds to the value at that index. Your task is to find two lines that, along with the x-axis, form a container that can hold the most water. The container’s area is determined by the distance between the lines and the height of the shorter line.

Leetcode 12: Integer to Roman

You are given a positive integer and need to convert it into a Roman numeral. Roman numerals are constructed by combining symbols from the set: I, V, X, L, C, D, M, where each symbol has a specific value. The conversion rules are based on subtractive notation for values like 4 (IV), 9 (IX), and so on, to avoid using symbols multiple times where not allowed.

Leetcode 15: 3Sum

Given an integer array nums, find all unique triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. The solution set must not contain duplicate triplets.

Leetcode 16: 3Sum Closest

You are given an integer array nums and an integer target. Find three integers in nums such that the sum is closest to the target. Return the sum of those three integers.

Leetcode 17: Letter Combinations of a Phone Number

Given a string of digits, return all possible letter combinations that the digits could represent based on the phone’s number-to-letter mapping.

Leetcode 18: 4Sum

You are given an array of integers nums and a target value. Your task is to find all unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that the sum of the four numbers equals the target value. The indices a, b, c, and d should be distinct.