All Posts

Leetcode 2583: Kth Largest Sum in a Binary Tree

You are given a 0-indexed array of strings words and two integers left and right. A string is considered a vowel string if it starts and ends with a vowel character (vowels are ‘a’, ’e’, ‘i’, ‘o’, ‘u’). Your task is to return the number of vowel strings in the array words where the indices fall within the range [left, right].

Leetcode 2641: Cousins in Binary Tree II

Given the root of a binary tree, replace the value of each node in the tree with the sum of all its cousins’ values. Two nodes are cousins if they have the same depth but different parents. The depth of a node is the number of edges from the root to the node.

Leetcode 2673: Make Costs of Paths Equal in a Binary Tree

You are given a perfect binary tree with n nodes, where each node has a cost associated with it. The tree is numbered from 1 to n, with node 1 as the root. For each node i, its left child is 2*i and its right child is 2*i + 1. You are allowed to increment the cost of any node by 1 any number of times. Your task is to return the minimum number of increments required to make the total cost of the path from the root to each leaf node equal.