Search Questions

Latest Questions | Page 16

#1

1. Simple Text Queries

In this challenge, you will be given an array of sentences and an array of queries. Determine which
sentences contain all of the words of a query. If no sentence contains all of the words, the answer to
that query is [-1].

Example:
sentences = ['bob and alice like to text each other', 'bob does not like to ski but does not like to fall',
'Alice likes to ski']
que

Asked in: Flipkart


Buyer: 0
Code Size: 26
#2

Solution

In a lively car showroom, an array of cars awaits, each with its distinctive features. Picture yourself mixing and matching these cars in unique
combinations to create dream blends which have an F-score equal to the XOR value of the combination.

Your mission: To compute the blend score, which is the XOR of the F-score values for all these dreamy combinations.

Now, it's time to r

Asked in: Unstop


Buyer: 0
Code Size: 9
#3

Solution

Rahul has an integer array called 'arr' of length N containing unique values. He wants to create a balanced tree where each parent node has
smaller valued nodes on its left and larger valued nodes on its right. This balanced tree should ensure that the depth of the two subtrees for every
node doesn't differ by more than one.

Your task is to assist him in creating this type of tree

Asked in: Unstop


Buyer: 0
Code Size: 30
#4

Problem Statement

You have a budget of x coins each day to buy beer, and your goal is to buy as many bottles of beer as possible before the price of beer in all shops exceeds your daily budget.
There are N shops, and each shop sells one bottle of beer per day. The price of beer in each shop increases by 1 coin per day after each purchase.
You can visit multiple shops in a single day, but you

Asked in: Unstop


Buyer: 0
Code Size: 16
#5

A substring is a group of contiguous characters in a string. For instance, all substrings of abc are [a, b, c, ab, bc, abc].

Given a binary representation of a number, determine the total number of substrings present that match the following conditions:

1. The 0s and 1s are grouped consecutively (e.g., 01, 10, 0011, 1100, 000111, etc.).
2. The number of 0s in the substring is equal to the n

Asked in: Cognizant


Buyer: 0
Code Size: 21
#6

How to Attempt?
Chocolate Arrangement
Alex loves chocolate a lot. His brother Sam gifts him 2^N boxes of chocolate. These boxes are arranged in 2 rows denoted by 2 arrays A and B both of size N. Each box of chocolate contains some number of chocolates which is represented by A[i] and B[i] (for 1 <= i <= N).
Alex wants the boxes of chocolate in those 2 rows to be arranged in such a way that the

Asked in: Siemens


Buyer: 0
Code Size: 11
#7

In order to ensure maximum security, the developers at Company employ multiple encryption methods to keep user data protected.
In one method, numbers are encrypted using a scheme called 'Pascal Triangle'. When an array of digits is fed to this system, it sums the adjacent digits. It then takes the rightmost digit (least significant digit) of each addition for the next step. Thus, the number of di

Asked in: Amazon


Buyer: 0
Code Size: 10
#8

In this problem, you are given an integer array, and you need to perform some operations on the array to make all the elements equal to 0. In one operation, you can select a prefix of the given array and increment or decrement all the elements of the prefix by 1.

You have an array, arr, consisting of n integers. Find the minimum number of operations required to convert every element of this arr

Asked in: Amazon


Buyer: 0
Code Size: 10
#9

Prime Jumps

There is a game that is played as follows:

There is a pawn located at cell 0, and its score is 0.
There is a row of n cells numbered from 0 to n-1 from left to right.
Each cell has a value, and the first cell always has a value of 0.
In a single move, the pawn can move either:
one cell to the right, or
some number p cells to the right where p is a prime number ending in 3, e

Asked in: Amazon


Buyer: 0
Code Size: 55
#10

2. SQL: Ecommerce Deal Report

An online shop needs a new deal history feature. Create a query that returns a list of the top three seller profiles with the highest total deals in June, 2022.

The result should have the following columns:
first_name / last_name | email | total.

total - the total amount of all deals for a specific profile
The result should be sorted in descending order by

Asked in: Amazon


Buyer: 0
Code Size: 12