# Cracking the coding interview: Print the pattern — 1

You a given a number **N**. You need to print the pattern for the given value of **N**.

For **N = 2** the pattern will be **2 2 1 12 1**

For **N = 3** the pattern will be **3 3 3 2 2 2 1 1 13 3 2 2 1 13 2 1**

**Example 1:**

**Input: **2

Output:

2 2 1 1 $2 1 $

**Example 2:**

**Input: **3

Output:

3 3 3 2 2 2 1 1 1 $3 3 2 2 1 1 $3 2 1 $

**Note: **The **Input/Output** format and **Example** is given are used for the system’s internal purpose, and should be used by a user for **Expected Output** only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

**Your Task:**

Since this is a function problem, you don’t need to worry about the test cases. Your task is to complete the function** printPat **which takes one argument ’N’ denoting the length of the pattern.**Note: **Instead of printing a new line print a **“$”** without quotes.

**Constraints:**

1 <= N <= 40

Solution: