Skip to content

Instantly share code, notes, and snippets.

View saadismail's full-sized avatar

Saad Ismail saadismail

View GitHub Profile
@saadismail
saadismail / rpass.sh
Created January 24, 2017 16:21
.bashrc function to generate n numbers of random passwords consisting of x characters
function rpass() {
if [ ! -n "$1" ]; then
echo "Usage: rpass noofchar count"
return 1
fi
if [ ! -n "$2" ]; then
echo "Usage: rpass noofchar count"
return 1
fi
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstring>
// Source: https://www.topcoder.com/community/data-science/data-science-tutorials/dynamic-programming-from-novice-to-advanced/
int m=4, n=4;
int a[4][4] = {{1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16}};
// int n=5,m=5;
#include <string>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;
int n,k,r,c;
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void) {
long long t,w,n;
while (cin >> t >> w >> n) {
public class Q2 {
public static int opToInt(char data) {
switch(data) {
case '/':
return 10;
case '*':
return 10;
case '+':
return 8;
case '-':
public class Queue <T> {
Node <T> front = null;
Node <T> rear = null;
int noOfElements = 0;
public void enqueue (T data) {
if (rear == null) {
front = rear = new Node<T> (data);
} else {
rear.next = new Node<T> (data);
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int n, i, j;
scanf("%d", &n);
int currValue, mainDiagonal=0, leadingDiagonal=0;
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &currValue);
#include <stdio.h>
#include <stdlib.h>
int** Input_Matrix(int *rows, int *columns) {
printf("Input the number of rows: ");
scanf("%d", rows);
printf("Input the number of columns: ");
scanf("%d", columns);
int **arr = (int **)malloc(*rows * sizeof(int *));
#include <iostream>
#include <vector>
#include <map>
#include <utility>
using namespace std;
vector <int> divisors;
map < pair< int, pair<bool, int> >, int > DP;
vector<int> ans;
#include <iostream>
#include <climits>
#include <cmath>
using namespace std;
int n;
double x, y;
double dist;