#2 Carpe diem Learning
Tags: python, 100daysofcode, devjournal, programming
Published: 2021-01-11 20:49:33


Today's Learning on
-------------
      
- [Coding](#coding)
- [Tasks done](#task)
- [Tips](#tips)
- [Ideas](#ideas)
- [Take away motivation](#motivation) 

### Coding <a name="coding"></a>
 - Easy to revise Python syntax in a nutshell from this [blog][1]
 - In Python, the Dictionary data types represent the implementation of hash tables. The Keys in the dictionary satisfy the following requirements.

The keys of the dictionary are hashable i.e. they are generated by the hashing function which generates a unique result for each unique value supplied to the hash function.
The order of data elements in a dictionary is not fixed.
 
    
### Tasks done <a name="task"></a>
- Attended ZOHO interview 2nd & 3rd round

#### Round 2

##### Question 1 : Print given number pattern using loop.

```
55555
54444
54333
54322
54321
```

##### Key Logic:
Split the question into two parts as follows

 ```
Part 1 => 5----  
          54---
          543--
          5432-
          54321
```
```
Part 2 => -5555
          --444
          ---33
          ----2
          -----
```

To iterate through rows, run an outer loop from 1 to rows (where rows are total rows to be printed).

1. To print the first part of the pattern, run an inner loop from columns to [columns- current_row](where columns are total columns to be printed). 
2. Inside this loop print the value of the current column.
3. To print the second part of the pattern, run another inner loop from 1 to [columns - current_row]. 
Inside this loop print the value of rows - [current_row + 1].

Refer to [this][2] article for the detailed explanation in C

#### 3rd Round 

##### Question 1: 
 
Program to print a snake matrix without using arrays 

Refer to [this][3] article for the detailed explanation in C

##### Question 2: 

Program to print a snake matrix in the following pattern without using arrays and if conditions.

Input : [ 1, 2, 4, 5, 2, 1, 5, 2, 10, 22, 5 ]
Output:
1 -> 2
2 -> 3
5 -> 3

##### Key Logic:

- Create a Hash Map to store the frequency of the elements.
Elements whose frequency is greater than 1 are the repeated elements.
- I got rejected in this question as I have used Dictionary(hashmap) to store the frequency of the elements but in the given question, they have asked to do use array. 

Refer to [this][4] article for the detailed explanation in Python

### Tips<a name="tips"></a>

- From today's Interview experience learned that while the coding focus on building the core logic of a program that brings the best-optimized solution calculated by its space & time taken

- Need in-depth working of data structures in basic programming languages C, C++, Java, Python because irrespective of programming language, interviewers expecting to implement data structures concepts in all of the above.

### Ideas<a name="ideas"></a>

- For procedural learning of cracking coding interview do heavy practice on _cracking the coding interview_ book.

### Motivation<a name="motivation"></a>
- _When making plans think big, when making progress think small_

[1]: https://www.csestack.org/basic-python3-syntax-code-example/
[2]: https://www.atnyla.com/c-program/program-to-print-number-pattern-pre-55555-54444-54333-54322-54321-pre-/762?page=23
[3]: https://gist.github.com/syedjafer/663538b0d7c4166af5ee1c2a560627ce
[4]: https://www.geeksforgeeks.org/find-the-frequencies-of-all-duplicates-elements-in-the-array/amp/