TCS Company

The fig shows an equilateral triangle of side length 5,which is divided into unit triangle. a valid path is a path from d triangle in d top row to the middle triangle in the bottom row, such that adjacent triangles in our path share a common edge and d path never travels up (from a lower row to a higher row) or revisites a triangle. An example of one such path is illustrated below……

How many valid path are there?
a)23
b)16
c)120
d)24

Read Solution (Total 5)

TCS Other Question

More and more programming languages today are embracing the phenomenon of automatic memory management. As a Language Development Lead your supervisor is responsible for managing memory allocation routines of the Language Compiler. Since this is beta release of the language your supervisor is developing, he wants to keep memory management routines clean and simple.

Rules for allocating memory are quite simple :
Continuous memory locations can be merged together to form a “Free List”. Free Lists are maintained via indexes in simple data structures.
When it comes to memory allocations, routines should prefer Exact-Fit over First-Fit
If and only if there is no Exact-Fit, the routines should find the First-Fit where the object can be allocated.
You are developing this memory-subsystem as per specifications provided by your supervisor. Go ahead and crack the problem. Specifications are as depicted below :

Input Format:

Line 1

Input absolute path of the memory representation file
Line 2

Memory allocation required by the object
File Format:

Each memory representation file consists of 4 column separated by a comma. File will end with a New Line character. The 4 fields are as depicted below :

Index Id, Start Offset, File Size, Delete Flag
Output Format:

Print “Inserted at index I”,where I is position where insertion is made or “Can not be inserted”,if insertion in any index is not possible

Line 1
For Valid Input,print
“Inserted at index I”,where I is position where insertion is made
Or
“Can not be inserted” if insertion is not possible



Sample Test Cases:

File:Input.txt

1,1,100,N

2,101,250,N

3,352,100,Y

4,453,50,N

5,504,100,Y

6,605,100,Y

7,606,100,N
Byteland country is very famous for it's own variety of rules and customs. People from the normal world only knows 26 alphabets but the scientists in the Byteland country always try to invent new alphabets. Let N be the number of alphabets invented by the Byteland country scientists. Alice is living in Byteland country and one of her friends gifted her a new pet on her Birthday. In the Byteland country each pet must contain a name as suggested by the astronomer. After consulting an astronomer Alice came to know that length of the pet name must be of L letters and among L letters she need to keep X number of letter prefix as suggested by the astronomer. Now Alice has decided to form the names by following the astronomer's suggestion, as Alice is weak in mathematics can you please help her to find out the number of valid names that she can form