Alphabet Rangoli

We came across a coding problem today on Hackerrank called Alphabet Rangoli. We need to solve this in Python. The link of the problem on HackerRank is Here: Link

Problem Statement

Alphabet Rangoli
Alphabet Rangoli

You are given an integer, Your task is to print an alphabet rangoli of size. (Rangoli is a form of Indian folk art based on the creation of patterns.)

Different sizes of rangoli are shown below:
Size 3

—-c—-
–c-b-c–
c-b-a-b-c
–c-b-c–
—-c—-

Size 5

——–e——–
——e-d-e——
—-e-d-c-d-e—-
–e-d-c-b-c-d-e–
e-d-c-b-a-b-c-d-e
–e-d-c-b-c-d-e–
—-e-d-c-d-e—-
——e-d-e——
——–e——–

The center of the rangoli has the first alphabet letter a, and the boundary has the alphabet letter (in alphabetical order).

Function Description

Complete the rangoli function.

Rangoli has the following parameters:

Int size: the size of the rangoli
Returns

string: a single string made up of each of the lines of the rangoli separated by a newline character (\n)
Input Format

Only one line of input containing size, the size of the rangoli.

Constraints

0 < size < 27

Solution

The solution to the Problem is here



READ MORE

Python-related posts Visit HERE

Data Structures related posts visit HERE

C/C++ related posts Visit HERE

Databases related posts Visit HERE

Algorithms related posts visit HERE

Data Science related posts visit HERE

Share the Knowledge