All Posts

Leetcode 1525: Number of Good Ways to Split a String

You are given a string s. You need to determine the number of valid ways to split s into two non-empty substrings such that the number of distinct letters in the left and right substrings is the same.

Leetcode 1529: Minimum Suffix Flips

You are given a binary string target and another string s initialized to all zeros. In one operation, you can flip all bits in the inclusive range starting from index i to n-1. The task is to determine the minimum number of operations needed to make s equal to target.

Leetcode 1540: Can Convert String in K Moves

You are given two strings s and t and a number k. Your task is to convert string s into string t using no more than k moves. In each move, you can choose an index j (1-based) from string s and shift the character at that index by i positions, where i is the current move number.

Leetcode 1541: Minimum Insertions to Balance a Parentheses String

You are given a string s containing only the characters '(' and ')'. A string is considered balanced if each '(' has a matching pair of consecutive '))' and if they appear in the correct order. Your task is to return the minimum number of insertions needed to make the string balanced.

Leetcode 1545: Find Kth Bit in Nth Binary String

Given two positive integers n and k, the binary string Sn is formed recursively. The task is to return the kth bit in the string Sn.

Leetcode 1573: Number of Ways to Split a String

Given a binary string, you need to split it into three non-empty parts such that each part contains the same number of ‘1’s. You must return the total number of ways to split the string, with the result modulo 10^9 + 7.