All Posts

Leetcode 2744: Find Maximum Number of String Pairs

You are given a list of distinct strings words, where each string consists of exactly two lowercase English letters. You are tasked with finding the maximum number of pairs of strings that can be formed where one string is the reverse of the other.

Leetcode 2766: Relocate Marbles

You are given a 0-indexed integer array ’nums’ representing the initial positions of marbles. You are also provided with two arrays, ‘moveFrom’ and ‘moveTo’, where each step moves marbles from one position to another. After performing all the moves, return the sorted list of unique positions that have at least one marble.

Leetcode 2810: Faulty Keyboard

You are given a string s. On your faulty keyboard, whenever you press ‘i’, the string typed so far is reversed. Pressing any other character types it normally. Simulate typing the entire string and return the final string displayed on the screen.

Leetcode 2899: Last Visited Integers

Given an integer array nums, where each element is either a positive integer or -1. For each -1, find the respective last visited positive integer. The ’last visited integer’ refers to the most recent positive integer seen before each -1.

Leetcode 2946: Matrix Similarity After Cyclic Shifts

You are given an m x n matrix ‘mat’ and an integer ‘k’. The rows of the matrix undergo cyclic shifts: even-indexed rows shift left, and odd-indexed rows shift right. After performing these k shifts, determine if the matrix is identical to its original form.

Leetcode 2960: Count Tested Devices After Test Operations

You are given an integer array batteryPercentages representing the battery levels of devices. Perform tests on each device in order, testing a device if its battery percentage is greater than 0 and decrementing the battery percentage of all subsequent devices by 1. Return the number of devices that can be tested after performing the operations.