2265 Partition Array According To Given Pivot
Partition Array According to Given Pivot You are given a 0-indexed integer array nums and an integer pivot. Rearrange nums such that the following conditions are satisfied: Every element less th...
Partition Array According to Given Pivot You are given a 0-indexed integer array nums and an integer pivot. Rearrange nums such that the following conditions are satisfied: Every element less th...
Merge Two 2D Arrays by Summing Values You are given two 2D integer arrays nums1 and nums2. nums1[i] = [idi, vali] indicate that the number with the id idi has a value equal to vali. nums2[i] = [...
Apply Operations to an Array You are given a 0-indexed array nums of size n consisting of non-negative integers. You need to apply n - 1 operations to this array where, in the ith operation (0-i...
Shortest Common Supersequence Given two strings str1 and str2, return the shortest string that has both *str1 and str2 as subsequences*. If there are multiple valid strings, return any of them. ...
Length of Longest Fibonacci Subsequence A sequence x1, x2, …, xn is Fibonacci-like if: n >= 3 xi + xi+1 == xi+2 for all i + 2 <= n Given a strictly increasing array arr of positive integ...
Maximum Absolute Sum of Any Subarray You are given an integer array nums. The absolute sum of a subarray [numsl, numsl+1, …, numsr-1, numsr] is abs(numsl + numsl+1 + … + numsr-1 + numsr). Return...
Number of Sub-arrays With Odd Sum Given an array of integers arr, return the number of subarrays with an odd sum. Since the answer can be very large, return it modulo 109 + 7. Example 1: *...
Most Profitable Path in a Tree There is an undirected tree with n nodes labeled from 0 to n - 1, rooted at node 0. You are given a 2D integer array edges of length n - 1 where edges[i] = [ai, bi]...
Construct Binary Tree from Preorder and Postorder Traversal Given two integer arrays, preorder and postorder where preorder is the preorder traversal of a binary tree of distinct values and posto...
Recover a Tree From Preorder Traversal We run a preorder depth-first search (DFS) on the root of a binary tree. At each node in this traversal, we output D dashes (where D is the depth of this n...