Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.

Basically, the deletion can be divided into two stages:

- Search for a node to remove.
- If the node is…

Given a non-empty array of unique positive integers `A`

, consider the following graph:

- There are
`A.length`

nodes, labelled`A[0]`

to`A[A.length - 1];`

- There is an edge between
`A[i]`

and`A[j]`

if and only if`A[i]`

and`A[j]`

share a common factor greater than 1.

Return the size of the largest connected component in the graph.

**Example 1:**

**Input: **[4,6,15,35]

**Output: **4

Given an array of integers `A`

, We need to sort the array performing a series of **pancake flips**.

In one pancake flip we do the following steps:

- Choose an integer
`k`

where`0 <= k < A.length`

. - Reverse the sub-array
`A[0...k]`

.

For example, if `A = [3,2,1,4]`

and we performed…

Given a function `rand7`

which generates a uniform random integer in the range 1 to 7, write a function `rand10`

which generates a uniform random integer in the range 1 to 10.

Do NOT use system’s `Math.random()`

.

**Example 1:**

**Input: **1

**Output: **[7]

**Example 2:**

**Input: **2

**Output: **[8,4]

**Example 3:**

**Input: **3

**Output: **[8,1,10]

**Note:**

`rand7`

is predefined.- Each testcase has one argument:
`n`

, the number of times that`rand10`

is called.

**Follow up:**

- What is the expected value for the number of calls to
`rand7()`

function? - Could you minimize the number of calls to
`rand7()`

?

Here you can see the performance of my solution (keep in mind that Runtime can vary depending on the server):

Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point of the interval i, which can be called that j is on the “right” of i.

For any interval i…

Write a program that outputs the string representation of numbers from 1 to *n*.

But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For numbers which are multiples of both three and five output “FizzBuzz”.

**Example:**

n = 15,Return:

[

"1",

"2",

"Fizz",

"4",

"Buzz",

"Fizz",

"7",

"8",

"Fizz",

"Buzz",

"11",

"Fizz",

"13",

"14",

"FizzBuzz"

]

Here you can see the performance of my solution (keep in mind that Runtime can vary depending on the server):

In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you will travel is given as an array `days`

. Each day is an integer from `1`

to `365`

.

Train tickets are sold in 3 different ways:

- a…

Find the sum of all left leaves in a given binary tree.

**Example:**

3

/ \

9 20

/ \

15 7There are two left leaves in the binary tree, with values9and15respectively. Return24.

Here you can see the performance of my solution (keep in mind that Runtime can vary depending on the server):

Implement the `StreamChecker`

class as follows:

`StreamChecker(words)`

: Constructor, init the data structure with the given words.`query(letter)`

: returns true if and only if for some`k >= 1`

, the last`k`

characters queried (in order from oldest to newest, including this letter just queried) spell one of the words in…

Given a list of **non-overlapping** axis-aligned rectangles `rects`

, write a function `pick`

which randomly and uniformily picks an **integer point** in the space covered by the rectangles.

Note:

- An
**integer point**is a point that has integer coordinates. - A point on the perimeter of a rectangle is
**included**in the…