2846. Minimum Edge Weight Equilibrium Queries in a Tree
There is an undirected tree with
nnodes labeled from0ton - 1. You are given the integernand a 2D integer arrayedgesof lengthn - 1, whereedges[i] = [ui, vi, wi]indicates that there is an edge between nodesuiandviwith weightwiin the tree.You are also given a 2D integer array
queriesof lengthm, wherequeries[i] = [ai, bi]. For each query, find the minimum number of operations required to make the weight of every edge on the path fromaitobiequal. In one operation, you can choose any edge of the tree and change its weight to any value.Note that:
- Queries are independent of each other, meaning that the tree returns to its initial state on each new query.
- The path from
aitobiis a sequence of distinct nodes starting with nodeaiand ending with nodebisuch that every two adjacent nodes in the sequence share an edge in the tree.Return an array
answerof lengthmwhereanswer[i]is the answer to theithquery.
2845. Count of Interesting Subarrays
You are given a 0-indexed integer array
nums, an integermodulo, and an integerk.Your task is to find the count of subarrays that are interesting.
A subarray
nums[l..r]is interesting if the following condition holds:
- Let
cntbe the number of indicesiin the range[l, r]such thatnums[i] % modulo == k. Then,cnt % modulo == k.Return an integer denoting the count of interesting subarrays.
Note: A subarray is a contiguous non-empty sequence of elements within an array.
2844. Minimum Operations to Make a Special Number
You are given a 0-indexed string
numrepresenting a non-negative integer.In one operation, you can pick any digit of
numand delete it. Note that if you delete all the digits ofnum,numbecomes0.Return the minimum number of operations required to make
numspecial.An integer
xis considered special if it is divisible by25.
2843. Count Symmetric Integers
You are given two positive integers
lowandhigh.An integer
xconsisting of2 * ndigits is symmetric if the sum of the firstndigits ofxis equal to the sum of the lastndigits ofx. Numbers with an odd number of digits are never symmetric.Return the number of symmetric integers in the range
[low, high].