Two of my accounts recently achieved the #1 and #2 leetcode ratings in South Korea. lol 😂

Leetcode contest speed-run global rank 10th

Two of my accounts recently achieved the #1 and #2 leetcode ratings in South Korea. lol 😂

Leetcode contest speed-run global rank 10th

2646. Minimize the Total Price of the Trips
There exists an undirected and unrooted tree with
nnodes indexed from0ton - 1. You are given the integernand a 2D integer arrayedgesof lengthn - 1, whereedges[i] = [ai, bi]indicates that there is an edge between nodesaiandbiin the tree.Each node has an associated price. You are given an integer array
price, whereprice[i]is the price of theithnode.The price sum of a given path is the sum of the prices of all nodes lying on that path.
Additionally, you are given a 2D integer array
trips, wheretrips[i] = [starti, endi]indicates that you start theithtrip from the nodestartiand travel to the nodeendiby any path you like.Before performing your first trip, you can choose some non-adjacent nodes and halve the prices.
Return the minimum total price sum to perform all the given trips.
2645. Minimum Additions to Make Valid String
Given a string
wordto which you can insert letters “a”, “b” or “c” anywhere and any number of times, return the minimum number of letters that must be inserted so thatwordbecomes valid.A string is called valid if it can be formed by concatenating the string “abc” several times.
2644. Find the Maximum Divisibility Score
You are given two 0-indexed integer arrays
numsanddivisors.The divisibility score of
divisors[i]is the number of indicesjsuch thatnums[j]is divisible bydivisors[i].Return the integer
divisors[i]with the maximum divisibility score. If there is more than one integer with the maximum score, return the minimum of them.
Given a
m x nbinary matrixmat, find the 0-indexed position of the row that contains the maximum count of ones, and the number of ones in that row.In case there are multiple rows that have the maximum count of ones, the row with the smallest row number should be selected.
Return an array containing the index of the row, and the number of ones in it.