Company's software team utilizes several algorithms to maintain data integrity, one of which targets the encoding of symmetrical names. Symmetrical names are unique in that they read identically in both directions, similar to palindromes in language parlance.
The chief aim of the algorithm is to rearrange the characters in the original symmetrical name according to these criteria:
- The rearra
Asked in: Amazon
Company is focused on using sophisticated algorithms to optimize inventory turnover within its warehouse network. In this case, you're given a task related to a specific operation with an array of
inventory levels.
Formally, you are given an array of positive integers, inventoryLevels, of size n. Additionally, you have two positive integers x and y, with x being equal to or smaller than y. You
Asked in: Amazon
Efficient Network
There are n computer systems connected together to form a network. The network can be represented as a rooted tree (rooted at master computer 1), where the connections are described using two arrays connect_from[]and connect_to[]. Each pair (connect_from[i], connect_to[i]) denotes an undirected edge between the two computers. Additionally, each computer has a value assigned to i
Asked in: ShareChat
Subsequence Sort
Given a binary string binary consisting of characters '0' and '1' only, perform the following 0
or more times.
ยท Choose any subsequence, sort the subsequence, and replace the original subsequence with the sorted sequence.
Next, there is an array of strings, arr, of length n, where each string has length / binary/ and consists of characters '0', '1' and '?'. Each '?' characte
Asked in: ShareChat
Break The Bricks
There are n bricks arranged in a row at positions numbered from 1 through n, inclusive. There is an array, newtons[n], that contains an integer indicating the number of newtons required to
smash a brick., (A newton is a unit of force.)
There are two hammers, one big and one small. The big hammer can smash any brick with one blow. The small hammer reduces the newtons require
Asked in: ShareChat
Flip Operations
A tree of n nodes is an undirected connected graph Hnving (n - 1) edges. Given an undirected
tree comprising of tree_nodes number of nodes numbered from 0 to tree_nodes - 1, and rooted at
node 0. Each node has an initially binary value (0 or 1) represented by the array initial[], and an
expected binary value represented by the array expected[].
The following operation can
Asked in: No companies listed
Word Count Tool
Determine the number of valid words in a given string s. A valid word contains at least 3 characters with only alphanumeric characters (i.e., the numbers 0-9, letters A-Z in either case), at least one vowel ('a', 'e', 'i', 'o', 'u'), and at least one consonant.
Example
Suppose s ="This is an example string 234".
Word Is Valid Reason
This Yes At least 3 c
Asked in: No companies listed
A subarray is any contiguous block of an array's elements. Given an array of integers, find the sum
of all elements of all subarrays of that array.
Example
For example, a three element array [4, 5, 6] can be made into the following subarrays:
1 element subarrays: [4], [5], [6]
2 element subarrays: [4,5], [5,6]
3 element subarrays: [4, 5, 6]
The sum of all subarrays is 4 + 5 + 6 + (4+5)
Asked in: No companies listed
Students in a class are asked to stand in ascending order according to their heights for the annual
class photograph. Determine the number of students not currentlylstanding in their correct
positions.
Example
height = [1, 1, 3, 3, 4, 1]
The 3 students indicated in red at indices 2, 4 and 5, are not in the right positions. The correct
positions are [1, 1, 1, 3, 3, 4]. Return 3.
Functi
Asked in: No companies listed
Amazon Prime Games is designing a game. The player needs to pass n rounds sequentially in this
game. Rules of play are as follows:
- The player loses power[i] health to complete round
- The player's health must be greater than 0 at all times.
- The player can choose to use armor in any one round. The armor will prevent damage of min(armor, power[il).
Determine the minimum starting health fo
Asked in: Amazon