All Posts
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 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.
Leetcode 2202: Maximize the Topmost Element After K Moves
You are given an integer array nums representing a pile, where nums[0] is the topmost element. You can perform the following operations in exactly k moves:
- Remove the topmost element of the pile (if it’s not empty).
- If any elements have been removed, you can add any one of them back onto the pile as the new topmost element.
Your goal is to determine the maximum value that can be at the top of the pile after exactly k moves. If it is not possible to have any elements left in the pile after k moves, return -1.