Today’s question is from Daily Leetcode Coding Challenge — May Edition. It is a hard-tagged question. Let us look into the problem statement.

Given a binary tree, we install cameras on the nodes of the tree.

Each camera at a node can monitor **its parent, itself, and its immediate children**.

Calculate the minimum number of cameras needed to monitor all nodes of the tree.

**Input: **[0,0,null,0,0]

**Output: **1

**Explanation: **One camera is enough to monitor all nodes if placed as shown.

Understanding the problem:

Since we want to minimize the number of cameras, one thing is clear we don't place…

Today’s question is from Daily Leetcode Coding Challenge — May Edition. It is a hard-tagged question. Let us look into the problem statement.

You are given an array `target`

of n integers. From a starting array `arr`

consisting of `n`

1's, you may perform the following procedure :

1. let

`x`

be the sum of all elements currently in your array.

2. choose index`i`

, such that`0 <= i < n`

and set the value of`arr`

at index`i`

to`x`

.

3. You may repeat this procedure as many times as needed.

Return `true`

*if it is possible…*

Today’s question is from Daily Leetcode Coding Challenge — May Edition. It is a medium-tagged question. Let us look into the problem statement.

In an **infinite** chessboard with coordinates from `-infinity`

to `+infinity`

, you have a **knight** at square `[0, 0]`

.

A knight has 8 possible moves it can make, as illustrated below. Each move is two squares in a cardinal direction, then one square in an orthogonal direction.

Return the minimum number of steps needed to move the knight to the square `[x, y]`

. It is guaranteed the answer exists.

**Input:** x = 5, y = 5

**Output:** 4

**Explanation: **[0…

Today’s question is from Daily Leetcode Coding Challenge — May Edition. It is a Hard-tagged question. Let us look into the problem statement.

A **valid number** can be split up into these components (in order):

1. A

decimal numberor aninteger.

2.(Optional) An`'e'`

or`'E'`

, followed by aninteger.

A **decimal number** can be split up into these components (in order):

1. (Optional) A sign character (either

`'+'`

or`'-'`

).

2. One of the following formats:

3. At least one digit, followed by a dot`'.'`

.

4. At least one digit, followed by a dot`'.'`

, followed by at least one…

Today’s question is from Daily Leetcode Coding Challenge — May Edition. It is a Hard-tagged question. Let us look into the problem statement.

Let’s say a positive integer is a **super-palindrome** if it is a palindrome, and it is also the square of a palindrome.

Given two positive integers `left`

and `right`

represented as strings, return *the number of **super-palindromes** integers in the inclusive range* `[left, right]`

.

**Input:** left = "4", right = "1000"

**Output:** 4

**Explanation**: 4, 9, 121, and 484 are superpalindromes. …

Today’s question is from Daily Leetcode Coding Challenge — May Edition. It is a medium-tagged question. Let us look into the problem statement.

You are given two arrays of positive integers, `boxes`

and `warehouse`

, representing the heights of some boxes of unit width and the heights of `n`

rooms in a warehouse respectively. The warehouse's rooms are labeled from `0`

to `n - 1`

from left to right where `warehouse[i]`

(0-indexed) is the height of the `ith`

room.

Boxes are put into the warehouse by the following rules:

- Boxes cannot be stacked.
- You can rearrange the insertion order of the…

Today’s question is from Daily Leetcode Coding Challenge — May Edition. It is a medium-tagged question. Let us look into the problem statement.

There are several cards **arranged in a row**, and each card has an associated number of points The points are given in the integer array `cardPoints`

.

In one step, you can take one card from the beginning or from the end of the row. You have to take exactly `k`

cards.

Your score is the sum of the points of the cards you have taken.

Given the integer array `cardPoints`

and the integer `k`

, return the *maximum…*

Given an integer `n`

, return *the least number of perfect square numbers that sum to* `n`

.

A **perfect square** is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, `1`

, `4`

, `9`

, and `16`

are perfect squares while `3`

and `11`

are not.

The brute force approach suggests using a recursive function to find all combination of perfect squares which sum to target. Then find the length of the combination which has min length. But that will work only on small numbers. …

A quick refresher on SQS Metrics

Before we see the metrics a quick glance at the **SQS workflow**

- The producer sends the message to the SQS queue.
- If there is no delay configuration, the message is available(visible) in the queue for all consumers. If we have a delay configuration then the message will stay in the queue in a delayed state and will become visible for the consumer(s) after the delay expires.
- Consumers poll the SQS queue for messages. This will return visible messages from the queue. This operation also makes the message to be invisible to consumers.
- Once the…

Two are better than one if they act as one.

Two pointer algorithm is one of the most commonly asked questions in any programming interview. This approach optimizes the runtime by utilizing some order (not necessarily sorting) of the data. It is generally applied on lists (arrays) and linked lists. This is generally used to search pairs in a sorted array. This approach works in constant space.

In this technique pointers represent either index or an iteration attribute like node’s next.

Cloud | ML | Big Data