Search Questions

Latest Questions | Page 2

#1

Prince was playing games on his computer all day, so his father decided to give him the task of arranging the books kept on the bookshelf. Prince can arrange the books on the bookshelf according to the book type, where an English alphabet denotes each book type. He is required to arrange the books in such a way that the book type having the lowest number of copies is kept first, and the book type

Asked in: AMAZON_HACKON


Buyer: 0
Code Size: 51
#2

You are given an NxN matrix 'mat' where each cell contains one of the two characters 'a' or 'z'. A man stands at the bottom-right corner of the matrix (mat[N-1][N-1]) and wants to reach the top-left corner of the matrix (mat[0][0]). The man can only move up or left at each step. Your task is to find the lexicographically smallest string that can be formed by following any valid path from mat[N-1][

Asked in: AMAZON_HACKON


Buyer: 1
Code Size: 60
#3

You want to transmit N packets over a network where each packet needs to be encrypted before being sent. Each packet has some integer data represented by the array data[]. To encrypt the data, you need to perform operations on the N packets. You are given 3 more arrays of length Q: 1. typeOfOperation[]: each element denotes the type of operation to be performed on data[i] (1 or 2), 2. numberOfPack

Asked in: AURIGO


Buyer: 0
Code Size: 18
#4

Ticket Distribution

Consider that John has N friends and there are M different types of tickets available for an event. Each friend i, including John (i.e., N + 1 people), possesses some ticket which is represented by a non-negative integer ticket[i]. The value at the last index of the array ticket[] denotes the ticket John has. Out of the N friends that John has, count the number of friends wh

Asked in: AURIGO


Buyer: 0
Code Size: 15
#5

On a popular discussion platform, some users with harmful intentions use anagram-based methods to hide certain banned terms. An anagram is a word or phrase created by rearranging the letters of another word or phrase, using all the original letters exactly once. Implement a function to identify and group anagrams within the network's data log to detect these concealment attempts.

Write a Python

Asked in: COGNIZANT


Buyer: 1
Code Size: 20
#6

Stemming is the process of extracting the base word from a word. For instance, the base for "worked" is "work". Use the following algorithm to stem a word: 1. If the word ends in 'ed', 'ly', or 'ing', remove the suffix. 2. If the resulting word is longer than 8 letters, keep the first 8 letters. Implement a function that takes a string of space-separated words and returns its stemmed counterpart.

Asked in: COGNIZANT


Buyer: 0
Code Size: 12
#7

There is an integer array arr[n] and an integer value d. The array is indexed from 1 to n. Count the number of distinct triplets (i, j, k) such that 0 < i < j < k ≤ n and the sum (a[i] + a[j] + a[k]) is divisible by d.

Example: a = [3, 3, 4, 7, 8], d = 5. The following triplets are divisible by d = 5. These are the triplets whose sum is divisible by d (1-based indexing):
· indices (1, 2, 3), s

Asked in: UKG


Buyer: 0
Code Size: 20
#8

There is an array of n non-negative integers, arr. In one operation, some positive integer x is chosen and 1 is subtracted from all the numbers of the array which are greater than or equal to x. Find the number of different final arrays possible after the operation is applied 0 or more times. Return the answer modulo (10^9 + 7).

Note: 1-based indexing is used. Different values of x can be chose

Asked in: UKG


Buyer: 0
Code Size: 28
#9

In a Salesforce environment, there are n developers working on a collaborative task in a workspace, where they plan to transfer a debug log sequentially. Each developer has a unique ID in the range of 1 to n, inclusive. The developer with ID i will always transfer the log to the developer specified at logReceiver[i], and this transfer occurs every second. Developer 1 always starts with the debug l

Asked in: SALESFORCE


Buyer: 0
Code Size: 26
#10

In Salesforce's annual hackathon, employees from a team are ranked based on their efficiency scores. These scores are represented as an array. The team lead wants to analyze subgroups of employees to identify groups with specific characteristics. Given: · n employees in a team standing in a line, · An array efficiency representing each employee's efficiency, and · An integer k (1 ≤ k ≤ n), represe

Asked in: SALESFORCE


Buyer: 0
Code Size: 34