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 1372: Longest ZigZag Path in a Binary Tree

Given the root of a binary tree, find the length of the longest ZigZag path in the tree. A ZigZag path is one where you move left and right alternately, starting from any node.

Leetcode 1376: Time Needed to Inform All Employees

A company has n employees with a unique ID for each employee from 0 to n-1. The head of the company is the one with headID. Each employee has one direct manager. The head will inform his direct subordinates, and they will inform their subordinates, and so on until all employees know about the urgent news. Each employee needs informTime[i] minutes to inform their direct subordinates. Return the total time required to inform all employees.

Leetcode 1381: Design a Stack With Increment Operation

Design a stack that supports increment operations on its elements. Implement the CustomStack class, which supports adding elements, popping the top element, and incrementing the bottom k elements.

Leetcode 1382: Balance a Binary Search Tree

Given the root of a binary search tree (BST), return a balanced BST containing the same node values. A balanced BST is one where the depth of the left and right subtrees of every node never differ by more than 1.

Leetcode 1386: Cinema Seat Allocation

A cinema has multiple rows, each with ten seats arranged in a line. Some seats are already reserved. You need to determine the maximum number of four-person groups that can be seated in the available seats. A four-person group requires four adjacent seats in one row. If an aisle splits a group in the middle, they can still be seated if there are two consecutive seats on both sides of the aisle.