Today's Learning on
Coding
- Easy to revise Python syntax in a nutshell from this blog
- 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
- 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).
- To print the first part of the pattern, run an inner loop from columns to columns- current_row.
- Inside this loop print the value of the current column.
- 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 article for the detailed explanation in C
3rd Round
Question 1:
Program to print a snake matrix without using arrays
Refer to this 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 article for the detailed explanation in Python
Tips
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
- For procedural learning of cracking coding interview do heavy practice on cracking the coding interview book.
Motivation
- When making plans think big, when making progress think small
Top comments (0)