All Posts

Leetcode 1657: Determine if Two Strings Are Close

Two strings are considered transformable into each other if you can convert one into the other by performing a series of operations. These operations include swapping any two characters or transforming all occurrences of one character into another.

Leetcode 1658: Minimum Operations to Reduce X to Zero

You are given an array of integers nums and an integer x. In each operation, you can either remove the leftmost or rightmost element from the array and subtract its value from x. The task is to determine the minimum number of operations required to reduce x to exactly 0, or return -1 if it’s not possible.

Leetcode 1663: Smallest String With A Given Numeric Value

You are given two integers n and k. Your task is to return the lexicographically smallest string of length n with a numeric value equal to k. The numeric value of a string is the sum of the numeric values of its characters, where ‘a’ = 1, ‘b’ = 2, …, and ‘z’ = 26.

Leetcode 1664: Ways to Make a Fair Array

You are given an array nums of integers. You are allowed to remove one element from the array at any index. After removing the element, the remaining array is called ‘fair’ if the sum of the values at the odd indices is equal to the sum of the values at the even indices. The task is to find how many indices you can remove such that the resulting array is fair.

Leetcode 1669: Merge In Between Linked Lists

You are given two linked lists: list1 and list2 with sizes n and m respectively. The task is to remove the nodes from position a to position b in list1 and replace them with list2. Return the head of the modified list.

Leetcode 1670: Design Front Middle Back Queue

Design a queue that supports operations at the front, middle, and back. Implement the FrontMiddleBackQueue class with methods for adding and removing elements from these positions.