This file contains hidden or 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
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; |
This file contains hidden or 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
let a = [1,8,4,5,9] | |
function bs(l,h,arr,key){ | |
let sArr = arr.sort((a,b)=>{ | |
return a > b | |
}) | |
This file contains hidden or 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
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} |
This file contains hidden or 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
function naivefib(n){ | |
if ( n < 3 ){ | |
return 1 | |
} | |
return naivefib(n-1) + naivefib(n-2) | |
} | |
console.log(naivefib(20)) | |
This file contains hidden or 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
#!/usr/bin/python | |
for letter in 'Python': # First Example | |
if letter == 'h': | |
continue | |
print ('Current Letter :', letter) | |
var = 10 # Second Example | |
while var > 0: |
This file contains hidden or 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
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): |
This file contains hidden or 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
class BinaryTreeNode { | |
constructor(value) { | |
this.value = value; | |
this.left = null; | |
this.right = null; | |
} | |
insertLeft(value) { | |
this.left = new BinaryTreeNode(value); |
This file contains hidden or 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
//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; | |
} | |
} |
This file contains hidden or 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
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){ |
This file contains hidden or 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
import functools | |
log = 'aadadhsbsgsbshhhhhhobobo' | |
l= list(log) | |
r = list(reversed(l)) | |
arr = [] | |
rev = [] | |
pl = [] | |
an = [] |