0% found this document useful (0 votes)
10 views1 page

Logic Pyramid Coding Challenge

The document describes a coding challenge to identify the logic behind a number series and use the numbers to construct a pyramid structure. The input specifies the width of the pyramid's bottom layer, and the numbers must be arranged according to given rules - with the first number at the top, the last N numbers forming the bottom layer from right to left, and numbers padded with zeros to maintain five digits. Examples are provided of the expected pyramid outputs for sample inputs. The formal input is the bottom layer width N, and the output must be the constructed pyramid following the specified rules.

Uploaded by

shashank
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Logic Pyramid Coding Challenge

The document describes a coding challenge to identify the logic behind a number series and use the numbers to construct a pyramid structure. The input specifies the width of the pyramid's bottom layer, and the numbers must be arranged according to given rules - with the first number at the top, the last N numbers forming the bottom layer from right to left, and numbers padded with zeros to maintain five digits. Examples are provided of the expected pyramid outputs for sample inputs. The formal input is the bottom layer width N, and the output must be the constructed pyramid following the specified rules.

Uploaded by

shashank
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

7/29/2016

TCS:CodeVitaCodingArena

[Link]

Logout

WelcomeSHASHANKSINGH

Home

CodingArena MyCompile&Run MySubmissions Graphs Feedback


TimeLeft

CodingArena

00 16 56
hr

min

sec

H
Rules&Regulations

Problem:LogicPyramid
LaunchCodeEditor

Identifythelogicbehindtheseries
62866120190276....
The numbers in the series should be used to create a Pyramid. The base of the Pyramid will be the widest and will start
converging towards the top where there will only be one element. Each successive layer will have one number less than
that on the layer below it. The width of the Pyramid is specified by an input parameter N. In other words there will be N
numbersonthebottomlayerofthepyramid.
ThePyramidconstructionrulesareasfollows

[Link]
[Link],withNthnumberbeingthe
rightmostnumberofthislayer.
3.Numberslessthan5digitsmustbepaddedwithzeroestomaintainthesanctityofaPyramidwhenprinted.
Havealookattheexamplesbelowtogetapictorialunderstandingofwhatthisruleactuallymeans.
Example
Ifinputis2,outputwillbe
00006
0002800066
Ifinputis3,outputwillbe
00006
0002800066
001200019000276
Formalinputandoutputspecificationsarestatedbelow
InputFormat:
FirstlineofinputwillcontainnumberNthatcorrespondstothewidthofthebottommostlayerofthePyramid

OutputFormat:
ThePyramidconstructedoutofnumbersintheseriesasperstatedconstructionrules

Constraints:

1.0<N<=14

SampleInputandOutput
SNo.

Input

Output

Note:

[Link]

1/2

You might also like