Sunteți pe pagina 1din 5

TCS Ignite Open Lab

TCS Ignite Open Lab


Coding Challenge

The only way to learn a new programming language is by writing programs in it.
[Type the author name]
- Brian Kernighan and Dennis Ritchie
[Type the company name]
Computer Scientists, Authors of The C Programming Language
[Pick the date]

TCS Ignite Open Lab

Cover Page:
The Mindful Macaques
The mural of the mindful macaque monkeys on the cover page is taken from the walls of
the Ignite research lab. In an experiment on Macaque monkeys, Giacomo Rizzolatti and
his group discovered mirror neurons, which are known to get activated when the
Macaques either perform or observe an action. Neuroscientist V.S Ramachandran,
known for his work in the fields of behavioral neurology and visual psychophysics has
highlighted the importance of mirror neurons in learning, human empathy, evolution of
language and even self awareness! While mirror neurons play a critical part in learning
industrial skills, they may not be central to learning in knowledge-driven economies.
Mindful Macaques by J.P. Ignite, TCS
The Artist
J Prabhakar, known as J.P., is a Chennai based artist who specializes in pen-and-ink
line drawings. With no formal education in art, J.P. is entirely self-schooled. Although
his work is focused exclusively on the sacred arts and his themes tend to be temples,
monuments and sculptures, he innovates constantly in terms of technique, technology,
materials, form and content. His pursuit of excellence is a constant source of
inspiration.

TCS Ignite Open Lab

The TCS Ignite Open Lab Coding Challenge

Introduction
In this challenge, you will be writing a program to solve the following problem.
You can use C, C++, C#, Java or Haskell to code your solution.
The Challenge
You have a block of platinum that can be exchanged in your bank either for cash
or for smaller blocks of platinum. If you exchange a block of m grams, you get
three blocks of weight m/2, m/3 and m/4 grams each. You don't get any fractional
part, as the division process rounds down the value. If you exchange the block of
platinum for cash, you get m units of currency. You can do any number of
exchanges for smaller blocks or currency.
Given the value of a block in grams as input, write a program that would print the
largest possible currency value that you can receive as the output. Assume that
the maximum value of a block that can be given as an input is 1,000,000,000
grams and the minimum value is 2 grams.
Sample input 1
12
Sample output 1
13
Explanation: You can change 12 into blocks of 12/2 = 6, 12/3 = 4 and 12/4 = 3,
and then exchange these for 6 + 4 + 3 = 13 units of currency

TCS Ignite Open Lab

Sample input 2

Sample output 2

Explanation: If you exchange 2 grams into smaller blocks, it gives 2/2 = 1, 2/3 =
0, 2/4 = 0, only 1 unit. Instead, you can directly exchange the block for 2 units of
currency.
Scope and Effort
Total expected effort is about 6 person days. This means that one person will be
able to solve this problem in 6 days.
Prerequisites
Any science graduate with programming knowledge will be able to attempt this
challenge. It requires a good knowledge of the chosen programming language
besides good analytical skills typically required to solve any programming
problem.
Submission Process
You have to submit the source code of the solution. Please note that your
program SHOULD NOT print any prompts (Please type the value of the block)
nor any header /footer (***Block Max Value***) as part of its output.
For example, if you are asked to print out the simple interest correct to two
decimal places for a user specified values of principal, rate of interest and
number of years, then only the following statements should be there
corresponding to reading the input and printing the output:

TCS Ignite Open Lab


scanf(%d %d %d, &principal, &rate, &years);
printf(%8.2f\n, principal*rate*years/100.0);

Evaluation
You will be evaluated on the following parameters.
S.No.
1
2
3
4
5

Parameter
Compilation and linking/executing without any errors
Number of test cases satisfied
Program structure aligned to programming language (modularity for C,
OOPS compliance for C++/C#/Java and functional programming
aspects for Haskell)
Algorithm
Code clarity (variable names, indentation, visual block separation, etc)

S-ar putea să vă placă și