SSM Run command on multiple hosts in parallel without SSH

Recently due to some updates from our security team, we had to install an agent on all our hosts in the AWS account. We run 1100+ EC2 instances in our account. These servers have varied OS (Amazon Linux, Fedora, CentOS, RHEL, Ubuntu, Windows, FreeBSD, etc. Also, these servers power various workloads like EMR (various versions), EKS, ECS, Airflow, Tableau, Alation. Many of these are vendor configured servers that have their own AMIs. Creating AMIs for each type with the agent would have taken a long time and a huge effort…

In this blog, we will go through a medium-tagged question. This question is frequently asked in interviews for Amazon & Facebook.

Given an array of meeting time intervals `intervals`

where `intervals[i] = [starti, endi]`

, return *the minimum number of conference rooms required*.

Example:

**Input:** intervals = [[9,10],[4,9],[5,17]]

**Output:** 2

We need to find how many concurrent meetings are happening. Once we have that info we can find the no of meeting rooms required. To find the concurrent meetings at any given time we need to know how many meetings’ start and end time covers that.

We can do a brute-force…

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

Evaluate the value of an arithmetic expression in Reverse Polish Notation.

Valid operators are `+`

, `-`

, `*`

, and `/`

. Each operand may be an integer or another expression.

**Note** that the division between two integers should truncate toward zero.

**Input:** tokens = ["2","1","+","3","*"]

**Output:** 9

**Explanation:** ((2 + 1) * 3) = 9

From the above example, we understand that the last two elements become operand whenever we encounter an operator. Also, once we have computed 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.

Given a list of strings `words`

and a string `pattern`

, return *a list of* `words[i]`

*that match* `pattern`

. You may return the answer in **any order**.

A word matches the pattern if there exists a permutation of letters `p`

so that after replacing every letter `x`

in the pattern with `p(x)`

, we get the desired word.

Recall that a permutation of letters is a bijection from letters to letters: every letter maps to another letter, and no…

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

Given the `root`

of a binary tree, return *the level order traversal of its nodes' values*. (i.e., from left to right, level by level).

**Input:** root = [3,9,20,null,null,15,7]

**Output:** [[3],[9,20],[15,7]]

Level order traversal is similar to BFS. We process all nodes at a level before we move on to the next level. In other words, first, we cover all grandparents, then all parents then all children.

Given an integer array `nums`

of size `n`

, return *the minimum number of moves required to make all array elements equal*.

In one move, you can increment or decrement an element of the array by `1`

.

**Input:** nums = [1,2,3]

**Output:** 2

We can make all number equal to a number. That number can be maximum number of the list or minimum number of that list. It can be also be a median. …

Given a list `paths`

of directory info, including the directory path, and all the files with contents in this directory, return *all the duplicate files in the file system in terms of their paths*. You may return the answer in **any order**.

A group of duplicate files consists of at least two files that have the same content.

A single directory info string in the input list has the following format:

`"root/d1/d2/.../dm f1.txt(f1_content) f2.txt(f2_content) ... fn.txt(fn_content)"`

It…

Given a list of words, each word consists of English lowercase letters.

Let’s say `word1`

is a predecessor of `word2`

if and only if we can add exactly one letter anywhere in `word1`

to make it equal to `word2`

. For example, `"abc"`

is a predecessor of `"abac"`

.

A *word chain *is a sequence of words `[word_1, word_2, ..., …`

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…*

Cloud | ML | Big Data