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
version: '3.8' | |
services: | |
sql: | |
image: mcr.microsoft.com/azure-sql-edge | |
container_name: sql | |
ports: | |
- "1433:1433" | |
environment: | |
ACCEPT_EULA: "1" |
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
#define ROW_1 2 | |
#define ROW_2 3 | |
#define ROW_3 4 | |
#define ROW_4 5 | |
#define ROW_5 6 | |
#define ROW_6 7 | |
#define ROW_7 8 | |
#define ROW_8 9 | |
#define COL_1 10 |
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
#Image Captcha: | |
from captcha.image import ImageCaptcha | |
image = ImageCaptcha | |
data = image.generate(‘9876543’) | |
image.write (‘9876543’,’sam.png’) |
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
# UNDIRECTED GRAPH | |
''' | |
ADJ MATRIX | |
ADJ LIST | |
''' | |
''' | |
V E | |
FOR EVERY EDGE |
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
# n convert it into binary | |
def intToBin(n): | |
return str(bin(n))[2:] | |
# bin to int | |
def binToInt(s): | |
return int(s,2) | |
# kth bit set from right | |
def kthbit(n,k): |
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
# ispowerof 2 | |
# n -> input | |
# True/False -> output | |
# check if n is a powerof 2 | |
# 512 -> True 512 = 2**9 | |
# 1024 -> True 1024 = 2**10 | |
def ispowerof2(n): | |
# T.C = O(1) | |
if n <= 0: |
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
# bitwise operator and - & | |
# bitwise operator or - | | |
# bitwise operator not - ~ | |
# bitwise operator xor - ^ | |
# bitwise operator right shift - >> | |
# bitwise operator left shift << | |
# rightshift is divide in power of 2 | |
# leftshift is multiply in power of 2 | |
def evenodd(n): | |
if n&1 == 1: |
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 math import * | |
def genprimes(n): | |
primes = [True]*(n+1) | |
primes[0] = False | |
primes[1] = False | |
for p in range(2,int(sqrt(n))+1): | |
if primes[p] == True: | |
for i in range(p*p,n+1,p): | |
primes[i] = False |
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
# Prime numbers two factors 1 , Number Itself | |
# Approach One O(n) | |
# Aprroach Two: Base Case + Hint: O(1) -> O(root(N)) | |
from math import * | |
def approach1(n): | |
divcnt = 0 | |
for i in range(1,n+1): # [1,n] | |
if n%i == 0: | |
divcnt+=1 |
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
# 24 [1,2,3,4,6,8,12,24] | |
from math import * | |
def fun1(n): | |
# T.C = O(n) | |
div1 = [] | |
for i in range(1,n+1): # [1,n] | |
if n%i == 0: | |
div1.append(i) | |
return div1 |
NewerOlder