Skip to content

Instantly share code, notes, and snippets.

View cypher-nullbyte's full-sized avatar
🎯
Focusing

cYpHeR cypher-nullbyte

🎯
Focusing
View GitHub Profile
@cypher-nullbyte
cypher-nullbyte / Question.txt
Created February 22, 2021 10:08
TicTacToe Problem | Vpropel
TicTacToe Game
Given the board configuration of the tic tac toe game, determine if the board is in either of the
following states: empty, player1 wins, player2 wins, draw or intermediate.
The board is said to be in initial state if all the cells contain ‘-1’,
player1 uses ‘1’ as his coin and player2 uses ‘2’ as his coin.
The game is draw when the board is full and no one has won the game.
The game is in intermediate state when no one has won and board is not full
First finish up taking the inputs. Then apply logic to find state.
@cypher-nullbyte
cypher-nullbyte / huffman.c
Created February 12, 2021 13:00
Huffman Coding Problem | Counting no of each type of alphabets(case insensitive) in a given string.
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
char str[20];
scanf("%[^\n]s",str);
int *counter= (int*)calloc(26,sizeof(int));
// int counter[26]={0};
@cypher-nullbyte
cypher-nullbyte / rsa.py
Created September 14, 2020 05:59 — forked from ErbaAitbayev/rsa.py
Simple Python RSA for digital signature with hashing implementation. For hashing SHA-256 from hashlib library is used.
import random
from hashlib import sha256
def coprime(a, b):
while b != 0:
a, b = b, a % b
return a
@cypher-nullbyte
cypher-nullbyte / CeaserCipher.py
Created August 19, 2020 11:24
Ceaser Cipher Encryption and Decryption in python | https://youtu.be/0T7wWlst4Io
'''
author: cYpHeR
Github: cypher-nullbyte
'''
# -----------------------
# We assume that our input text is only lowercase string of alphabets without spaced
# LET US START
def Ceaser_encrypt(text,s):
@cypher-nullbyte
cypher-nullbyte / 2d1.c
Last active February 22, 2021 10:12
2D Arrays_using pointers(all 4 ways) in c/c++
/*2D array using array of pointers to 1D_array(or block of linear memory)
---------------------------
*/
#include<stdio.h>
#include<stdlib.h>
int main()
{
int r,c;
@cypher-nullbyte
cypher-nullbyte / Question(water_and_jugs).txt
Created May 25, 2020 10:28
Vpropel VIT | POD | 24/05/2020 | Water and Jugs | 34
Water and Jugs
You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to determine whether it is possible to measure exactly z litres using these two jugs.
If z liters of water is measurable, you must have z liters of water contained within one or both buckets by the end.
Operations allowed:
Fill any of the jugs completely with water.
Empty any of the jugs.
@cypher-nullbyte
cypher-nullbyte / Question(cipher_text_generation).txt
Created May 21, 2020 17:30
Vpropel VIT | POD | 21/05/2020 | Cipher text generation | 25
Cipher text generation
Encryption is a security technique where the text message is converted into unreadable form called as Cipher text.
Generate a cipher text using polygraphic substitution method based on linear algebra. Each letter is represented by a number modulo 26.
To encrypt a message, each block of n letters (considered as an n-component vector) is multiplied by an invertible n × n matrix, against modulus 26.
The matrix used for encryption is the cipher key, and it should be chosen randomly from the set of invertible n × n matrices (modulo 26).
Generate a cipher text for a text message of 3 letter alphabet. Hence the key should be 3*3 matrix.
@cypher-nullbyte
cypher-nullbyte / Question(crossy_roads).txt
Last active May 21, 2020 09:29
Vpropel VIT | POD | 20/05/2020 | Crossy Roads | 14
Crossy Roads
Given a array where index 0 represents the distance walked towards north index 1 represents the distance walked
towards west index 2 represents the distance walked towards south and index 3 represents the distance walled towards east
and index 4 represents the distance towards north ,index 5 represents the distance towards west and so on
Assume that you are initially at origin. Given the distances find out whether you’ll cross the path you walked before
Print Yes if they cross or else No
@cypher-nullbyte
cypher-nullbyte / Question(chalk_sticks).txt
Last active May 20, 2020 08:30
Vpropel VIT | POD | 19/05/2020 | Chalk sticks | 14
Chalk sticks
Ganesh has n chalk sticks of various lengths. He tries to build a square out of the chalk sticks he have. Given the length of n chalk sticks check whether he can build a square or not. Every chalk stick must be used
Example:-
Input:- [1,1,2,2,2]
Output:-Yes
Explanation:-As square of side length 2 can be formed from the given lengths
@cypher-nullbyte
cypher-nullbyte / Question(cryptography_II).txt
Last active May 21, 2020 19:56
Vpropel VIT | POD | 18/05/2020 | Cryptography-II | 08
Cryptography-II
A message containing letters from A-Z is being encoded to numbers using the following mapping way:'A' -> 1,'B' -> 2,'Z' -> 26
Beyond that, now the encoded string can also contain the character '*', which can be treated as one of the numbers from 1 to 9.
Given the encoded message containing digits and the character '*', return the total number of ways to decode it.
For example, 1* has got 18 decoding possibilities as shown below
(i) 1* - 1 may be decoded as A and * can take values from 1 to 9