All Posts
Leetcode 2024: Maximize the Confusion of an Exam
You are given a string answerKey
where each character represents a question’s answer (either ‘T’ for True or ‘F’ for False), and an integer k
. You are allowed to change at most k
answers. Your task is to find the maximum number of consecutive ‘T’s or ‘F’s in the string after performing at most k
changes.
Leetcode 2055: Plates Between Candles
You are tasked with processing a string of plates (’*’) and candles (’|’) arranged on a table. For a set of queries, you must determine the number of plates that are enclosed by candles within specified substrings of the string.
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:
- There must be at least ’time’ days before and after the current day.
- The number of guards on the days before the current day must be non-increasing.
- 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.