Search Questions

Latest Questions | Page 10

#1

Question 2

Implement a Least Frequently Used (LFU) cache data structure of size cacheSize that handles two types of queries: GET and PUT.

A GET query attempts to retrieve the value of a given key.

If the key is present in the cache, it is returned.

Otherwise, it returns -1.

A PUT query updates or inserts a key-value pair into the cache.

When the cache is full, the least frequentl

Asked in: ShareChat


Buyer: 0
Code Size: 74
#2

A forklift operator navigates products within an automotive parts warehouse. The dashboard displays a real-time map showing open and blocked sections as an n x m matrix of 1's (open) and 0's (blocked). The operator starts at the top-left corner of the map at warehouse[0][0] and aims to reach the bottom-right corner at warehouse[n-1][m-1].

Movements can only be made to the right or downward. Giv

Asked in: ShareChat


Buyer: 1
Code Size: 44
#3

1. Question 1
Given a chessboard of n rows (top to bottom) and n columns (left to right). In each move, a knight moves either:
2 column positions and 1 row position
2 row positions and 1 column position
In other words, a move is 2 steps along one axis and 1 step along a perpendicular axis.
Given a starting position A and ending position B, calculate the minimum number of moves needed by the k

Asked in: ShareChat


Buyer: 0
Code Size: 38
#4

The class uses a novel system where the success of an individual is assigned to a symbol. These symbols have the following precedence:

A > B > C > D > E > F

The symbols are collected and fed into the assessment robot. The success of the class is determined in the following way, with the output in green at the end:

"AAABBCDDEFF"

Sometimes it is ambiguous what the output is. In this case

Asked in: Siemens


Buyer: 0
Code Size: 24
#5

4. Question 4

Your colleagues often bring a few books to the office to read, then put them into shared book shelves, so other people have the chance to read it as well. After some days, the shelves have become messier and messier. As the office manager you are tasked to develop a function to sort them.

As the basic information of a book, the name, author and edtion will be recorded.
The fun

Asked in: Siemens


Buyer: 0
Code Size: 31
#6

You are a part of the World of Wizards—a global society of magicians. It's your task to create a "warped-spell" that helps the society ensure the authenticity and secrecy of its members.

All the members meet once a month at a secret club. In order to ensure the authenticity of members, each member is sent a "secret" number of 1-7 digits, 10 days before the meeting.

On the meeting day, each m

Asked in: Siemens


Buyer: 0
Code Size: 32
#7

1. Question 1

You've just started as a trainer in Thoughtworks University, and you want to make a good first impression. You start investigating how to make it easier to organise the coding sessions. It turns out that trainers are spending a lot of their time finding out the average confidence of the participants.

The coding sessions are organised based on how confident the participants are

Asked in: Siemens


Buyer: 1
Code Size: 9
#8

The Amazon warehouse receives a multitude of packages every day, each assigned a unique identifier from 1 to n. The warehouse manager must sort the packages, not by their identifiers, but rather through a specific process defined by a permutation sorterOrder that ensures optimal processing.

Initially, the number of sorted packages, sortedCount, is zero. In each operation, the manager sifts thro

Asked in: Amazon


Buyer: 4
Code Size: 13
#9

2. Code Question 2

In Amazon's vast inventory system, there's a need to ensure the efficient organization of product codes, represented by the sequence productSeq.

The product codes are categorized using characters 'a' through 'g'. For better management, a substring of product codes is considered valid if the count of each character within the substring does not exceed the number of distinct

Asked in: Amazon


Buyer: 0
Code Size: 39
#10

The data engineers at Amazon are working on partitioning their server chains. There is a linear chain of n servers numbered from 1 to n, where the cost parameter associated with the ith server is represented by the array cost[i]. These servers need to be partitioned into exactly k different server chains. The cost of partitioning a server chain servers[i : j] is defined as cost[i] + cost[j]. The t

Asked in: Amazon


Buyer: 1
Code Size: 14