All Posts

Leetcode 1888: Minimum Number of Flips to Make the Binary String Alternating

You are given a binary string s consisting of ‘0’s and ‘1’s. You can perform two operations on the string:

  1. Type-1: Move the first character of the string to the end.
  2. Type-2: Flip the value of any character in the string (‘0’ becomes ‘1’ and ‘1’ becomes ‘0’). The goal is to make the string alternating, i.e., no two adjacent characters should be the same. You need to find the minimum number of type-2 operations required to make the string alternating.

Leetcode 1898: Maximum Number of Removable Characters

You are given two strings s and p, where p is a subsequence of s. You are also given an array removable containing distinct indices of s. Your task is to determine the maximum number of indices you can remove from s such that p is still a subsequence of the remaining string.

Leetcode 1903: Largest Odd Number in String

You are given a string num, which represents a large integer. Your task is to find the largest odd integer that can be formed from any non-empty substring of num. If no odd integer exists, return an empty string.

Leetcode 1904: The Number of Full Rounds You Have Played

You are participating in an online chess tournament where rounds start every 15 minutes, starting at 00:00. You are given two times: loginTime and logoutTime. Your task is to calculate the number of full rounds you have participated in during the period from loginTime to logoutTime.

Leetcode 1910: Remove All Occurrences of a Substring

Given two strings s and part, perform the following operation on s until all occurrences of the substring part are removed. Find the leftmost occurrence of the substring part and remove it from s. Return s after removing all occurrences of part.

Leetcode 1915: Number of Wonderful Substrings

A string is considered wonderful if at most one letter appears an odd number of times. Given a string word consisting of the first ten lowercase English letters (‘a’ through ‘j’), return the total number of wonderful non-empty substrings in the string word. If the same substring appears multiple times, each occurrence should be counted separately.