Hi,i am writing blogs for our platform House of Bots on Artificial Intelligence, Machine Learning, Chatbots, Automation etc after completing my MBA degree. ...

Full BioHi,i am writing blogs for our platform House of Bots on Artificial Intelligence, Machine Learning, Chatbots, Automation etc after completing my MBA degree.

Tools Used In Java World, Java Developers Must Aware With These Tools

2 days ago

Matlab For Data Science And Learn Matlab From Free Online Courses

2 days ago

Understanding The Term Data Mining And Its Impact On Business

2 days ago

What Are The Questions for Data Scientists And For What Courses They Have To Enroll?

3 days ago

These Computer Science Certifications Really Pay Good To You

112557 views

Which Programming Language Should We Use On A Regular Basis?

97548 views

Python Opens The Door For Computer Programming

59904 views

10 Plus Videos to Learn Artificial Intelligence, Machine Learning & Data Science For Beginners: Must Watch!

51627 views

If You Are a Data Scientist Then You Should Have These Apps In Your Mobile

51138 views

### The 30 Minute Guide To Crack Your Next Programming Language & Coding Interview

- The breakdown of coding interviews, and how to prepare for them.
- Helpful tips and hints for each algorithm topic (arrays, trees, dynamic programming, etc.), along with recommended LeetCode practice questions to review core concepts and to improve on those topics.

- How big is the size of the input?
- How big is the range of values?
- What kind of values are there? Are there negative numbers? Floating points? Will there be empty inputs?
- Are there duplicates within the input?
- What are some extreme cases of the input?
- How is the input stored? If you are given a dictionary of words, is it a list of strings or a trie?

- Write pure functions as often as possible.
- Use pure functions because they are easier to reason with and can help reduce bugs in your implementation.
- Avoid mutating the parameters passed into your function, especially if they are passed by reference, unless you are sure of what you are doing.
- Achieve a balance between accuracy and efficiency. Use the right amount of functional and imperative code where appropriate. Functional programming is usually expensive in terms of space complexity because of non-mutation and the repeated allocation of new objects. On the other hand, imperative code is faster because you operate on existing objects.
- Avoid relying on mutating global variables. Global variables introduce state.
- Make sure that you do not accidentally mutate global variables, especially if you have to rely on them.

- Empty sequence
- Sequence with 1 or 2 elements
- Sequence with repeated elements

- Test kth bit is set: num & (1 << k) != 0
- Set kth bit: num |= (1 << k)
- Turn off kth bit: num &= ~(1 << k)
- Toggle the kth bit: num ^= (1 << k)
- To check if a number is a power of 2: num & num - 1 == 0.

Check for overflow/underflow

Negative numbers

- Adjacency matrix
- Adjacency list
- HashMap of HashMaps

- Common: Breadth first search (BFS), Depth first search (DFS)
- Uncommon: Topological sort, Dijkstra's algorithm
- Rare: Bellman-Ford algorithm, Floyd-Warshall algorithm, Prim's algorithm, and Kruskal's algorithm

def traverse(matrix):

rows, cols = len(matrix), len(matrix[0])

visited = set()

directions = ((0, 1), (0, -1), (1, 0), (-1, 0))

def dfs(i, j):

if (i, j) in visited:

return

visited.add((i, j))

# Traverse neighbors

for direction in directions:

next_i, next_j = i + direction[0], j + direction[1]

if 0 <= next_i < rows and 0 <= next_j < cols: # Check boundary

# Add any other checking here ^

dfs(next_i, next_j)

for i in range(rows):

for j in range(cols):

dfs(i, j)

- Empty graph
- Graph with one or two nodes
- Disjoint graphs
- Graph with cycles

- Single interval
- Non-overlapping intervals
- An interval totally consumed within another interval
- Duplicate intervals

- Getting the kth from the last node: Have two pointers, where one is k nodes ahead of the other. When the node ahead reaches the end, the other node is k nodes behind.
- Detecting cycles: Have two pointers, where one pointer increments twice as much as the other. If the two pointers meet, it means that there is a cycle.
- Getting the middle node: Have two pointers. One pointer increments twice as much as the other. When the faster node reaches the end of the list, the slower node will be at the middle.

- Count the number of nodes in the linked list
- Reverse a linked list in place
- Find the middle node of the linked list using fast or slow pointers
- Merge two lists together

- Single node
- Two nodes
- Linked list has cycle. Clarify with the interviewer whether there can be a cycle in the list. Usually the answer is no.

- Sum of 1 to N = (n+1) * n/2
- Sum of GP = 2Â° + 2Â¹ + 2Â² + 2Â³ + â?¦ 2^n = 2^(n+1)-1
- Permutations of N = N! / (N-K)!
- Combinations of N = N! / (K! * (N-K)!)

- Division by 0
- Integer overflow and underflow

- Many grid-based games can be modeled as a matrix. For example, Tic-Tac-Toe, Sudoku, Crossword, Connect 4, and Battleship. It is not uncommon to be asked to verify the winning condition of the game. For games like Tic-Tac-Toe, Connect 4, and Crosswords, verification has to be done vertically and horizontally. One trick is to write code to verify the matrix for the horizontal cells. Then transpose the matrix, reusing the logic used for horizontal verification to verify originally vertical cells (which are now horizontal).
- Transposing a matrix in Python is simply:
- transposed_matrix = zip(*matrix)

- Empty matrix. Check that none of the arrays are 0 length.
- 1 x 1 matrix.
- Matrix with only one row or column.

- Rabin Karp, which conducts efficient searches of substrings, using a rolling hash
- KMP, which conducts efficient searches of substrings

- Sorting both strings should produce the same resulting string. This takes O(nlgn) time and O(lgn) space.
- If we map each character to a prime number and we multiply each mapped number together, anagrams should have the same multiple (prime factor decomposition). This takes O(n) time and O(1) space.
- Frequency counting of characters will help to determine if two strings are anagrams. This also takes O(n) time and O(1) space.

- Reverse the string and it should be equal to itself.
- Have two pointers at the start and end of the string. Move the pointers inward till they meet. At any point in time, the characters at both pointers should match.

- For substrings, you can terminate early once there is no match.
- For subsequences, use dynamic programming as there are overlapping subproblems. Check out this question.

- Empty string
- Single-character string
- Strings with only one distinct character

- Empty tree
- Single node
- Two nodes
- Very skewed tree (like a linked list)

- Maximum Depth of Binary Tree
- Same Tree
- Invert or Flip Binary Tree
- Binary Tree Maximum Path Sum
- Binary Tree Level Order Traversal
- https://leetcode.com/problems/serialize-and-deserialize-binary-tree/
- Serialize and Deserialize Binary Tree
- Subtree of Another Tree
- Construct Binary Tree from Preorder and Inorder Traversal
- Validate Binary Search Tree
- Kth Smallest Element in a BST
- Lowest Common Ancestor of BST

- Implement Trie (Prefix Tree)
- Add and Search Word
- Word Search II

- Decide on a programming language
- Study CS fundamentals
- Practice solving algorithm questions
- Internalize the Do's and Don'ts of interviews
- Practice by doing mock technical interviews
- Interview successfully to get the job