Skip to content

Instantly share code, notes, and snippets.

View tamaramalysh5991's full-sized avatar
🏠
Working from home

Tamara Malysheva tamaramalysh5991

🏠
Working from home
View GitHub Profile
@tamaramalysh5991
tamaramalysh5991 / gist:5a955056b13f126bf2c38fcf0be0f57f
Created September 14, 2023 09:21
promt study for coding intreviews
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
---
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
# 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)
""" 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:
>>> 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']}
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:
def integers():
i = 1
while True:
yield i
i = i + 1
i1 = integers()
next(i1)
1
next(i1)
2