All Posts

Leetcode 1371: Find the Longest Substring Containing Vowels in Even Counts

Given a string s, find the size of the longest substring containing each vowel (‘a’, ’e’, ‘i’, ‘o’, ‘u’) an even number of times.

Leetcode 1422: Maximum Score After Splitting a String

You are given a binary string s consisting of characters ‘0’ and ‘1’. Your task is to split the string into two non-empty substrings (a left substring and a right substring) and return the maximum score that can be achieved by splitting the string. The score is the sum of the number of ‘0’s in the left substring and the number of ‘1’s in the right substring. Find the maximum score by evaluating all possible splits.

Leetcode 1423: Maximum Points You Can Obtain from Cards

You are given an array cardPoints representing the points of cards arranged in a row. In each step, you can pick the first or the last card from the row. Your goal is to pick exactly k cards and maximize the sum of the points of the cards you select.

Leetcode 1442: Count Triplets That Can Form Two Arrays of Equal XOR

You are given an array of integers arr. We want to find the number of triplets (i, j, k) where 0 <= i < j <= k < arr.length, such that the bitwise XOR of elements between indices i and j-1 (inclusive) equals the bitwise XOR of elements between indices j and k (inclusive).

Leetcode 1480: Running Sum of 1d Array

You are given an array of integers nums. Your task is to calculate the running sum of the array, where each element at index i represents the sum of all elements from index 0 to index i in the original array.

Leetcode 1524: Number of Sub-arrays With Odd Sum

You are given an array of integers arr. Your task is to count the number of subarrays whose sum is odd. Since the answer can be a large number, return it modulo (10^9 + 7).