All Posts

Leetcode 1695: Maximum Erasure Value

You are given an array of positive integers. Your task is to erase a subarray containing only unique elements and return the maximum sum of the subarray you can erase.

Leetcode 1696: Jump Game VI

You are given a 0-indexed integer array ’nums’ and an integer ‘k’. You start at index 0 and can jump up to ‘k’ steps forward at a time. Your task is to find the maximum sum of elements you can get by jumping to the last index, visiting subarrays of unique elements.

Leetcode 1701: Average Waiting Time

A restaurant with a single chef serves customers. Each customer arrives at a specific time and waits for the chef to prepare their order. The chef can only serve one customer at a time and prepares orders in the order they were received. The goal is to calculate the average waiting time of all customers. The waiting time of a customer is the time between their arrival and when they receive their order.

Leetcode 1702: Maximum Binary String After Change

You are given a binary string consisting of only ‘0’s and ‘1’s. You can perform two types of operations on this string any number of times:

  • Operation 1: Replace any occurrence of the substring ‘00’ with ‘10’.
  • Operation 2: Replace any occurrence of the substring ‘10’ with ‘01’.

Your goal is to apply these operations and transform the binary string into the largest possible binary string in terms of its decimal value. A string ‘x’ is considered larger than string ‘y’ if the decimal value of ‘x’ is greater than that of ‘y’.

Leetcode 1705: Maximum Number of Eaten Apples

You have a special apple tree that grows apples for ’n’ days. On each day ‘i’, the tree grows ‘apples[i]’ apples, which rot after ‘days[i]’ days. That means, apples grown on day ‘i’ will rot after ‘i + days[i]’. You can eat at most one apple per day, and you can continue eating after the first ’n’ days. You want to know the maximum number of apples you can eat.

Leetcode 1706: Where Will the Ball Fall

You have a 2-D grid representing a box, and a number of balls that will be dropped into the box. The box has diagonal boards in each cell, which can redirect the balls either left or right. Your task is to determine the path of each ball dropped from the top of the box. The ball can either fall out of the bottom, or get stuck if it hits a ‘V’ shaped pattern between two boards or is redirected into a wall.