{{ message }}

Instantly share code, notes, and snippets.

# pknowledge

Created May 29, 2021
Arduino Tutorial for Beginners – LED Matrix With Arduino
View main.c
 #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
Created Sep 2, 2020
How to Create Image & Audio CAPTCHA in Python
Created Jul 4, 2020
Competitive Programming with Python | Graph Representation | ADJACENCY LIST VS. ADJACENCY MATRIX https://youtu.be/CGOox3yLLYU
View GraphRepresentation.py
 # UNDIRECTED GRAPH ''' ADJ MATRIX ADJ LIST ''' ''' V E FOR EVERY EDGE
Created Jun 23, 2020
Competitive Programming with Python | Bit Magic : Interconversion, Kth Bit, Single Number https://youtu.be/4-rgHbeqjTU
View BitMagic.py
 # 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):
Created Jun 22, 2020
Competitive Programming with Python-Bit Magic- Power of 2 + One's in Binary Representation of Number https://youtu.be/SdP4j-n8S0g
View BitMagic.py
 # 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:
Created Jun 19, 2020
View bitwise.py
 # 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:
Created Jun 18, 2020
Sieve of Eratosthenes | Competitive Programming with Python https://youtu.be/-wIYdmPiHcA
View Sieve.py
 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
Created Jun 9, 2020
Number Theory for Competitive Programming with Python - Compare Primality Test in O(n) vs O(root(n)) https://youtu.be/4UZufg54dFc
View primalitytest.py
 # 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
Created Jun 9, 2020
Number Theory for Competitive Programming Using Python - Find Divisors Of A Number O(sqrt(n))
View divisors.py
 # 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
Created Jun 7, 2020
create a car is controlled from Bluetooth via Android SmartPhone
View main.c
 #include // Import Soft Uart library #include // Import Servo library // Bluetooth communication pins #define TX 2 #define RX 4 // L298N communication pins #define IN1 3 #define IN2 5