Skip to content

Instantly share code, notes, and snippets.

View saadismail's full-sized avatar

Saad Ismail saadismail

View GitHub Profile
#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);
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);
public class Q2 {
public static int opToInt(char data) {
switch(data) {
case '/':
return 10;
case '*':
return 10;
case '+':
return 8;
case '-':
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void) {
long long t,w,n;
while (cin >> t >> w >> n) {
#include <string>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;
int n,k,r,c;
#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;
@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