This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I need to prepare for the coding part of the software developer interview. | |
Please teach me the following topics related to coding problem-solving: | |
Sliding Window | |
Two Pointers | |
Fast & Slow Pointers | |
Merge Intervals | |
Cyclic Sort | |
In-place Reversal of a LinkedList | |
Tree Breadth-First Search | |
Tree Depth First Search |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
ai_tutor: | |
Author: JushBJJ | |
name: Mr. Ranedeer | |
version: '2.4.16' | |
features: | |
personalization: | |
depth: | |
description: This is the depth of the content the student wants to learn. | |
A low depth will cover the basics, and generalizations while a high depth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Data structure to store a Binary Tree node | |
class Node: | |
def __init__(self, data, left=None, right=None): | |
self.data = data | |
self.left = left | |
self.right = right | |
def __repr__(self): | |
return str(self.data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" yrange implementation (using yield) | |
that take any param (power of number), | |
the iterator should NEVER END, | |
instead of raising StopIteration - | |
the behavior should be to continue from starting element, i.e. | |
1,2,3,4,1,2,3,4,1,2,3,4 etc. | |
An infinite number generator, from 0 to the maximum limit put in the function | |
Args: | |
upper_limit (int): The upper limit of the range to generate. | |
Yields: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> dictionary1 = {'1':'one', '2':'two', '3':'three'} | |
>>> dictionary2 = {'1':'uno', '2':'dos', '3':'tres'} | |
>>> combined = {key:[dictionary1[key], dictionary2[key]] for key in dictionary1} | |
>>> combined | |
{'3': ['three', 'tres'], '2': ['two', 'dos'], '1': ['one', 'uno']} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Iterable | |
def reverse_iter(iterable): | |
"""Generator return reverse iterable | |
Args: | |
iterable_varibale - object, implement the iterator protocol. | |
Yields: | |
Iterable starting from the end. | |
Raises: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def integers(): | |
i = 1 | |
while True: | |
yield i | |
i = i + 1 | |
i1 = integers() | |
next(i1) | |
1 | |
next(i1) | |
2 |