All Posts

Leetcode 2186: Minimum Number of Steps to Make Two Strings Anagram II

You are given two strings, s and t. In each step, you can append any character to either s or t. Your task is to determine the minimum number of steps required to make s and t anagrams of each other.

Leetcode 2187: Minimum Time to Complete Trips

You are given an array ’time’ where each element ’time[i]’ represents the time taken by the ith bus to complete a trip. Your task is to calculate the minimum amount of time required for all buses to complete at least ’totalTrips’ trips in total. Each bus can complete multiple trips consecutively.

Leetcode 2191: Sort the Jumbled Numbers

You are given a mapping array where each index represents a digit, and the value at each index represents the mapped digit in a shuffled decimal system. You are also given an integer array ’nums’. Your task is to sort the array ’nums’ in non-decreasing order based on the mapped values of each element. While sorting, the original integers in ’nums’ should not be changed, only their mapped values should be considered for sorting.

Leetcode 2192: All Ancestors of a Node in a Directed Acyclic Graph

You are given a directed acyclic graph (DAG) with n nodes, numbered from 0 to n-1. Along with this, you are given a list of directed edges where each edge [fromi, toi] indicates a directed edge from node fromi to node toi. For each node in the graph, you need to determine the list of all its ancestors. A node u is an ancestor of node v if there is a path from u to v through one or more directed edges. Return a list answer where answer[i] contains the sorted list of ancestors of the i-th node.

Leetcode 2196: Create Binary Tree From Descriptions

You are given a list of triplets representing the structure of a binary tree. Each triplet [parent, child, isLeft] indicates that parent is the parent of child, and if isLeft is 1, child is the left child of parent, otherwise, it’s the right child. Your task is to reconstruct the binary tree and return the root node.

Leetcode 2201: Count Artifacts That Can Be Extracted

You are given an n x n grid and a list of rectangular artifacts buried under it. Each artifact is represented by a list [r1, c1, r2, c2], where (r1, c1) is the top-left corner and (r2, c2) is the bottom-right corner of the artifact. You are also given a list of dig coordinates representing cells in the grid where excavation occurs. Once all parts of an artifact are uncovered, you can extract it. Your task is to return the total number of artifacts that you can fully uncover and extract.