All Posts

Leetcode 2816: Double a Number Represented as a Linked List

You are given the head of a non-empty linked list representing a non-negative integer, where each node contains a single digit of the number. Your task is to double the integer represented by the linked list and return the resulting number as a new linked list.

Leetcode 2817: Minimum Absolute Difference Between Elements With Constraint

You are given a 0-indexed integer array nums and an integer x. Find the minimum absolute difference between two elements in the array such that their indices are at least x apart.

Leetcode 2825: Make String a Subsequence Using Cyclic Increments

Given two strings, str1 and str2, you can perform an operation on str1 where you select a set of indices and increment the characters at those indices cyclically. The task is to check if it is possible to make str2 a subsequence of str1 by performing the operation at most once.

Leetcode 2826: Sorting Three Groups

You are given an array nums containing elements that are either 1, 2, or 3. In each operation, you can remove an element from the array. The task is to return the minimum number of operations required to make the array non-decreasing.

Leetcode 2829: Determine the Minimum Sum of a k-avoiding Array

Given two integers, n and k, construct a k-avoiding array of length n. A k-avoiding array is an array of distinct positive integers where no two elements sum up to k. Return the minimum possible sum of such an array.

Leetcode 2830: Maximize the Profit as the Salesman

You are a salesman with n houses placed on a number line, numbered from 0 to n-1. You are given a list of offers where each offer is of the form [start, end, gold], indicating that a buyer wants to purchase all houses from index start to end (inclusive) for gold amount of gold. Your task is to maximize your total earnings by strategically selecting offers such that no two buyers purchase the same house.