1365. How Many Numbers Are Smaller Than the Current Number

1365. How Many Numbers Are Smaller Than the Current Number Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j’s such that j != i and nums[j] < nums[i]. Return the answer in an array. 1 2 3 4 5 6 7 8 9 10 Example 1: Input: nums = [8,1,2,2,3] Output: [4,0,1,1,3] Explanation: For nums[0]=8 there exist four smaller numbers than it (1, 2, 2 and 3)....

<span title='2021-04-17 00:00:00 +0000 UTC'>April 17, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

1827. Minimum Operations to Make the Array Increasing

1827. Minimum Operations to Make the Array Increasing You are given an integer array nums (0-indexed). In one operation, you can choose an element of the array and increment it by 1. For example, if nums = [1,2,3], you can choose to increment nums[1] to make nums = [1,3,3]. Return the minimum number of operations needed to make nums strictly increasing. An array nums is strictly increasing if nums[i] < nums[i+1] for all 0 <= i < nums....

<span title='2021-04-17 00:00:00 +0000 UTC'>April 17, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance

1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance There are n cities numbered from 0 to n-1. Given the array edges where edges[i] = [fromi, toi, weighti] represents a bidirectional and weighted edge between cities fromi and toi, and given the integer distanceThreshold. Return the city with the smallest number of cities that are reachable through some path and whose distance is at most distanceThreshold, If there are multiple such cities, return the city with the greatest number....

<span title='2021-04-11 00:00:00 +0000 UTC'>April 11, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

1631. Path With Minimum Effort

1631. Path With Minimum Effort You are a hiker preparing for an upcoming hike. You are given heights, a 2D array of size rows x columns, where heights[row][col] represents the height of cell (row, col). You are situated in the top-left cell, (0, 0), and you hope to travel to the bottom-right cell, (rows-1, columns-1) (i.e., 0-indexed). You can move up, down, left, or right, and you wish to find a route that requires the minimum effort....

<span title='2021-04-11 00:00:00 +0000 UTC'>April 11, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

1779. Find Nearest Point That Has the Same X or Y Coordinate

1779. Find Nearest Point That Has the Same X or Y Coordinate You are given two integers, x and y, which represent your current location on a Cartesian grid: (x, y). You are also given an array points where each points[i] = [ai, bi] represents that a point exists at (ai, bi). A point is valid if it shares the same x-coordinate or the same y-coordinate as your location. Return the index (0-indexed) of the valid point with the smallest Manhattan distance from your current location....

<span title='2021-04-11 00:00:00 +0000 UTC'>April 11, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

133. Clone Graph

133. Clone Graph Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contains a val (int) and a list (List[Node]) of its neighbors. 1 2 3 4 class Node { public int val; public List<Node> neighbors; } Test case format: For simplicity sake, each node’s value is the same as the node’s index (1-indexed). For example, the first node with val = 1, the second node with val = 2, and so on....

<span title='2021-04-09 00:00:00 +0000 UTC'>April 9, 2021</span>&nbsp;·&nbsp;4 min&nbsp;·&nbsp;volyx

1192. Critical Connections in a Network

1514. Path with Maximum Probability There are n servers numbered from 0 to n-1 connected by undirected server-to-server connections forming a network where connections[i] = [a, b] represents a connection between servers a and b. Any server can reach any other server directly or indirectly through the network. A critical connection is a connection that, if removed, will make some server unable to reach some other server. Return all critical connections in the network in any order....

<span title='2021-04-08 00:00:00 +0000 UTC'>April 8, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

1514. Path with Maximum Probability

1514. Path with Maximum Probability You are given an undirected weighted graph of n nodes (0-indexed), represented by an edge list where edges[i] = [a, b] is an undirected edge connecting the nodes a and b with a probability of success of traversing that edge succProb[i]. Given two nodes start and end, find the path with the maximum probability of success to go from start to end and return its success probability....

<span title='2021-04-07 00:00:00 +0000 UTC'>April 7, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

1306. Jump Game III

1306. Jump Game III Given an array of non-negative integers arr, you are initially positioned at start index of the array. When you are at index i, you can jump to i + arr[i] or i - arr[i], check if you can reach to any index with value 0. Notice that you can not jump outside of the array at any time. 1 2 3 4 5 6 7 8 Example 1: Input: arr = [4,2,3,0,3,1,2], start = 5 Output: true Explanation: All possible ways to reach at index 3 with value 0 are: index 5 -> index 4 -> index 1 -> index 3 index 5 -> index 6 -> index 4 -> index 1 -> index 3 1 2 3 4 5 6 7 Example 2: Input: arr = [4,2,3,0,3,1,2], start = 0 Output: true Explanation: One possible way to reach at index 3 with value 0 is: index 0 -> index 4 -> index 1 -> index 3 1 2 3 4 5 Example 3: Input: arr = [3,0,2,1,2], start = 2 Output: false Explanation: There is no way to reach at index 1 with value 0....

<span title='2021-04-06 00:00:00 +0000 UTC'>April 6, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree

1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree Given two binary trees original and cloned and given a reference to a node target in the original tree. The cloned tree is a copy of the original tree. Return a reference to the same node in the cloned tree. Note that you are not allowed to change any of the two trees or the target node and the answer must be a reference to a node in the cloned tree....

<span title='2021-04-06 00:00:00 +0000 UTC'>April 6, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

1584. Min Cost to Connect All Points

1584. Min Cost to Connect All Points You are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi]. The cost of connecting two points [xi, yi] and [xj, yj] is the manhattan distance between them: |xi - xj| + |yi - yj|, where |val| denotes the absolute value of val. Return the minimum cost to make all points connected. All points are connected if there is exactly one simple path between any two points....

<span title='2021-04-06 00:00:00 +0000 UTC'>April 6, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

538. Convert BST to Greater Tree

538. Convert BST to Greater Tree Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST. As a reminder, a binary search tree is a tree that satisfies these constraints: The left subtree of a node contains only nodes with keys less than the node’s key....

<span title='2021-04-06 00:00:00 +0000 UTC'>April 6, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

897. Increasing Order Search Tree

897. Increasing Order Search Tree Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child. 1 2 3 4 Example 1: Input: root = [5,3,6,2,4,null,8,1,null,null,null,7,9] Output: [1,null,2,null,3,null,4,null,5,null,6,null,7,null,8,null,9] 1 2 3 4 Example 2: Input: root = [5,1,7] Output: [1,null,5,null,7] Constraints:...

<span title='2021-04-06 00:00:00 +0000 UTC'>April 6, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

1813. Sentence Similarity III

1813. Sentence Similarity III A sentence is a list of words that are separated by a single space with no leading or trailing spaces. For example, “Hello World”, “HELLO”, “hello world hello world” are all sentences. Words consist of only uppercase and lowercase English letters. Two sentences sentence1 and sentence2 are similar if it is possible to insert an arbitrary sentence (possibly empty) inside one of these sentences such that the two sentences become equal....

<span title='2021-04-05 00:00:00 +0000 UTC'>April 5, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

690. Employee Importance

690. Employee Importance You are given a data structure of employee information, which includes the employee’s unique id, their importance value and their direct subordinates’ id. For example, employee 1 is the leader of employee 2, and employee 2 is the leader of employee 3. They have importance value 15, 10 and 5, respectively. Then employee 1 has a data structure like [1, 15, [2]], and employee 2 has [2, 10, [3]], and employee 3 has [3, 5, []]....

<span title='2021-04-05 00:00:00 +0000 UTC'>April 5, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx