Implement a function that returns the minimum number of operations needed to ensure the string s (of length n) contains no segments of exactly m consecutive '0's.
In one operation, you can do the following:
- Select a contiguous segment of length k and make every bit in this segment '1'.
The function getMinOperations will take three inputs:
- string s: a string representing s.
- int m: an
Asked in: AMAZON
The manager of an Amazon warehouse needs to ship n products from different locations, the location of the th product is represented by an array locations[i]. The manager is allowed to perform one operation at a time. Each operation is described below
- If the inventory has two or more products. the manager can pick two products x and y from the inventory if they have different locations. i.e. l
Asked in: AMAZON
There are m cities in a 1-dimensional country, where each city is represented by an integer between 1 through m. There are n Amazon warehouses, where the ith warehouse can deliver to cities in the
range cityStart[i] to cityEnd[i] for better delivery management.
For example, if there are m = 10 cities, and n = 2 warehouses cityStart = [3, 1] and cityEnd = [10, 5] then the first warehouse deliv
Asked in: AMAZON
Count comparisons
You are given a 2-D matrix M of dimensions N x D. You have to decide ranking based on the given matrix, rankings are defined as follows:
- Index i is said to be ahead of index j in rankings if the first index at which element value differs in row M[i] and M[j] has a greater value in row M[i].
- If for index i and index j, all the elements in row M[i] and M[j] are the same,
Asked in: GOOGLE
Circular path -
You are given the following:
- Two integers N and K
- Two arrays of integers A and B of size N.
Consider N circular paths. The i-th circular path has the center at the coordinate (A[i], B[i]) and radius K.
There are Q queries. Each query consists of two integers L and R. For each query, Alice starts from the L-th circular path and she needs to know whether she can reac
Asked in: GOOGLE
Remaining elements
You are given two arrays A and B of size N. Your task is to remove some numbers from array A such that the following conditions are met:
1. The remaining elements of array A are strictly increasing from left to right.
2. The corresponding elements from B must also be extracted. For example, if you have removed the ith element of array A, then the ith element of array B mu
Asked in: GOOGLE
Key Generation Vulnerabilities: Finding the Least Vulnerability Factor with Modifications
2. Code Question 2
The developers at Amazon IAM are working on identifying vulnerabilities in their key generation process. The key is represented by an array of integers, where the h integer is denoted by key[i]. The vulnerability factor of the array (key) is defined as the maximum length of a subarray t
Asked in: AMAZON
You own a recruiting agency and you are trying to analyze data from the recruiting process.
After doing a data pull, you have a database containing 2 tables - interviews and positions.
The interviews table contains the following columns:
- id: a unique ID for each interview session
- position_id: ID for the position that the interview was for
- candidate_id: ID for the candidate that was
Asked in: INFOTECH
You are helping your professor at the university to generate a report containing three columns: name, grade, and mark. You are given a table of grades and students. Your professor has instructed you to create the report according to the following specifications:
- He doesn't want the names of those students who received a grade lower than 'C'.
- Higher grades in the report should be entered fi
Asked in: INFOTECH
Question: The kingdom has been given terrible news: the King has passed away. While the nation is mourning, the noblemen need to decide who will take the throne next.
The late King had many children, and now it is necessary to determine their order of succession according to their seniority.
The list of the King's children is represented as a table "Successors" with the following attributes:
Asked in: INFOTECH