All Posts

Leetcode 2087: Minimum Cost Homecoming of a Robot in a Grid

You are given a grid of size m x n and two positions: the robot’s starting position (startPos) and its home position (homePos). The robot can move left, right, up, or down, with associated costs for moving to new rows and columns. Calculate the minimum total cost for the robot to move from its start position to its home position.

Leetcode 2090: K Radius Subarray Averages

Given an array of integers, you need to compute the k-radius average for each element in the array. The k-radius average for an element at index i is the average of the elements from index i - k to i + k (inclusive). If there are fewer than k elements before or after the index i, the result for that index will be -1.

Leetcode 2091: Removing Minimum and Maximum From Array

You are given an array of distinct integers. Your task is to remove the elements that hold the minimum and maximum values in the array. A deletion can either be from the front or the back of the array. Your objective is to find the minimum number of deletions required to remove both of these elements.

Leetcode 2095: Delete the Middle Node of a Linked List

You are given the head of a linked list. Your task is to remove the middle node from the linked list and return the modified list. The middle node is defined as the ⌊n / 2⌋th node, where n is the number of nodes in the list, using 0-based indexing.

Leetcode 2096: Step-By-Step Directions From a Binary Tree Node to Another

You are given a binary tree where each node has a unique value between 1 and n. You are also given a start node and a destination node, each represented by their values. Your task is to find the shortest path from the start node to the destination node in terms of directions. The directions should be represented by a string using the characters ‘L’, ‘R’, and ‘U’, where ‘L’ means left child, ‘R’ means right child, and ‘U’ means moving to the parent node.

Leetcode 2100: Find Good Days to Rob the Bank

You are planning a bank robbery with a gang of thieves. You are given a list, ‘security’, where each element represents the number of guards present on duty each day. You are also given an integer, ’time’, which represents the number of days before and after the current day that must have specific guard arrangements for it to be a good day for the robbery. A good day to rob the bank is defined as:

  1. There must be at least ’time’ days before and after the current day.
  2. The number of guards on the days before the current day must be non-increasing.
  3. The number of guards on the days after the current day must be non-decreasing. Return a list of all the days that are good days to rob the bank.