Skip to content

Instantly share code, notes, and snippets.

View hillal20's full-sized avatar

Hilal Aissani hillal20

View GitHub Profile
@hillal20
hillal20 / merge.js
Created October 2, 2018 17:36
PeriodicLazyCoordinates created by hillal20 - https://repl.it/@hillal20/PeriodicLazyCoordinates
let a = [ 1,3,4,7,9]
let b = [ 2,5,6,10,14,18]
function Merge(a,b,n,m){
let c = []
let i = 0;
let j = 0;
@hillal20
hillal20 / MyBinaryST.js
Created October 1, 2018 03:33
PeriodicLazyCoordinates created by hillal20 - https://repl.it/@hillal20/PeriodicLazyCoordinates
let a = [1,8,4,5,9]
function bs(l,h,arr,key){
let sArr = arr.sort((a,b)=>{
return a > b
})
@hillal20
hillal20 / AllSetADDedToANumber.js
Last active September 27, 2018 01:05
FamousFrizzyEngineering created by hillal20 - https://repl.it/@hillal20/FamousFrizzyEngineering
let arr = [1,2,3,2]
// {} let start from the left elemnt (1)
// / \
// {} not taken {1} token
// / \ / \
// {2} {} {1,2} {1}
// / \ / \ / \ / \
//{2,3}{2} {} {3} {1,2,3} {1,2} {1,3}. {1}
@hillal20
hillal20 / dynamicPrograming.js
Last active September 25, 2018 04:18
FamousFrizzyEngineering created by hillal20 - https://repl.it/@hillal20/FamousFrizzyEngineering
function naivefib(n){
if ( n < 3 ){
return 1
}
return naivefib(n-1) + naivefib(n-2)
}
console.log(naivefib(20))
@hillal20
hillal20 / continue.py
Last active September 17, 2018 21:59
NegligibleNotableProgramminglanguage created by hillal20 - https://repl.it/@hillal20/NegligibleNotableProgramminglanguage
#!/usr/bin/python
for letter in 'Python': # First Example
if letter == 'h':
continue
print ('Current Letter :', letter)
var = 10 # Second Example
while var > 0:
@hillal20
hillal20 / pythonClasses.py
Created September 17, 2018 20:50
NegligibleNotableProgramminglanguage created by hillal20 - https://repl.it/@hillal20/NegligibleNotableProgramminglanguage
class Build:
def __init__(self, name , age , city):
self.name = name
self.age = age
self.city = city
# def __str__(self):
# return str({self.name,self.age,self.city})
def __repr__(self):
@hillal20
hillal20 / checkIfBSTBalanced.js
Last active September 13, 2018 03:01
DiscreteSnappyScientist created by hillal20 - https://repl.it/@hillal20/DiscreteSnappyScientist
class BinaryTreeNode {
constructor(value) {
this.value = value;
this.left = null;
this.right = null;
}
insertLeft(value) {
this.left = new BinaryTreeNode(value);
@hillal20
hillal20 / BinaryTreeNode.js
Last active September 12, 2018 01:32
GruesomeEagerDiskdrive created by hillal20 - https://repl.it/@hillal20/GruesomeEagerDiskdrive
//sortedArray = [4, 10, 11, 18, 42, 43, 47, 49, 55, 67, 79, 89, 90, 95, 98, 100];
class BinaryTreeNode {
constructor(value) {
this.value = value;
this.left = null;
this.right = null;
}
}
@hillal20
hillal20 / set vs obj
Created September 11, 2018 15:28
set vs obj
let numbers = [1,5,3,6,3,3,1]
let st = new Set(numbers)
console.log(st)
for ( let i of st ){
console.log(i)
}
console.log('billal')
let obj = { bill:"b", hill:'h'}
for ( let i in obj){
@hillal20
hillal20 / longrstpalindrom.py
Last active September 8, 2018 03:19
AdmiredDishonestConditions created by hillal20 - https://repl.it/@hillal20/AdmiredDishonestConditions
import functools
log = 'aadadhsbsgsbshhhhhhobobo'
l= list(log)
r = list(reversed(l))
arr = []
rev = []
pl = []
an = []