Task - Level1 Algorithm Module

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

General instructions

1. The approach of solving the Problem solely depends on the Candidate 


2. Make sure to have Draw.io diagrams for the workflowns and application architecture 
3. Every configuration, code written should be pushed on git (Private Repo) 
4. Your are not permitted to share the doc with anyone, even with your colleagues 
 
 
1. Problem​: A chain of Grocery Store is located at different geographical locations in a
State [Take any State of INDIA]. The Store has its application Interface by which users
can order the Groceries. Now, The user wants to order some groceries and the choices
of users are not available in one store.

The Application has promised the following:


● Order Can be delivered from Five nearest Located Stores [In same State only]
● Order Can be Separated between Multiple Stores and Then will be delivered
● Delivering an Item from other stores will ask for additional fees of 10% per item
[Other stores means outside current Location]
● If the Price is more than the Order price after additional fees from multiple stores,
then the 3% Discount will also be given per order
● If final price after discount is still higher than some of the items will be removed
from the order to make it less than or equal to the Order Price

Implementation:
● Nearest Stores should be located using Dijkstra Algorithm
● Final Order Items should be filtered by Knapsack Algorithm [Dynamic
Programming approach only]
● We don’t ask for UI design, solution can be processed in console way inputs

Coding Details:
● User should be able to pass the input
● Code documentation should be added

2.) Random Stack Generator


Problem: ​We need to create a Game for where we move from basic level to advanced. The
Game will create some random meaningful colored Stacks and then we have to arrange the
Stacks with the same color combinations. For Eg. We have 3 Stacks [2 with color values and 1
empty]. We need to move by using stack implementation to have the same color in one stack.

Implementation:
● Colors used in one level should be n-1 where n is number of Stacks
● After 3 levels we should increase the number of stacks and colors
● The random generation of colors in a stack should never be in such a way that it is a
np-complete​ problem. It should always be possible to solve the level.
● We don’t ask for UI design, solution can be processed in console way inputs

Coding Details:
● User should be able to pass the input
● Code documentation should be added

3.) Problem: Akash needs every accumulator to contain the same amount of energy. Initially every
accumulator has some amount of energy: the ​i-​ th accumulator has ​a​i units of energy. Energy can be
transferred from one accumulator to the other. Every time ​x units of energy are transferred (​x is not
necessarily an integer) ​k percent of it is lost. That is, if ​x units were transferred from one accumulator
to the other, amount of energy in the first one decreased by ​x units and in other increased by

units.

Your task is to help Akash find what maximum equal amount of energy can be stored in each
accumulator after the transfers.

Input

First line of the input contains two integers ​n and ​k (​1 ≤ ​n​ ≤ 10000, 0 ≤ ​k​ ≤ 99​) — number
of accumulators and the percent of energy that is lost during transfers.

Next line contains ​n integers ​a1​ ​, ​a​2​, ... , ​a​n — amounts of energy in the first, second, .., ​n-​ th
accumulator respectively (​0 ≤ ​a​i​ ≤ 1000, 1 ≤ ​i 
​ ≤ ​n)​ .
Output

Output maximum possible amount of energy that can remain in each of accumulators after the
transfers of energy.

The absolute or relative error in the answer should not exceed ​10​ - 6​.

Example:
Input

3 50

421

Output:

2.000000000

Input
2 90
1 11

Output
1.909090909

 
 
 

You might also like