Skip to content

Instantly share code, notes, and snippets.

@Sara3
Sara3 / pig.sb
Last active July 29, 2016 05:39
Pig
This is a game of two players where each player rolls the dice.
The player gets to keep their number or risk rolling a 1 which will make their turn total equal to zero and the turn changes.
@Sara3
Sara3 / bitwise
Last active November 26, 2016 04:44
bitwise
//is Unique: Implement an algorithm to determine if a //string has all unique characters. No additional
//data tractures
#include <iostream>
using namespace std;
//bruth force
bool isunique(string str){
int checker=0;
for(int i=0; i<str.size(); i++){
@Sara3
Sara3 / RuleOfThree.cpp
Last active December 26, 2016 21:40
I am trying to use (copy constructor, destractor, and overloaded assignment operator) What am I missing up?
#include <iostream>
using namespace std;
class linkedList{
public:
struct Node{
int data;
Node* next;
};
2017-03-06T00:36:21.544284+00:00 heroku[web.1]: Starting process with command `npm start`
2017-03-06T00:36:25.216245+00:00 app[web.1]: npm ERR! Linux 3.13.0-110-generic
2017-03-06T00:36:25.216843+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2017-03-06T00:36:25.218099+00:00 app[web.1]: npm ERR! npm v3.10.10
2017-03-06T00:36:25.217433+00:00 app[web.1]: npm ERR! node v6.10.0
2017-03-06T00:36:25.223647+00:00 app[web.1]:
2017-03-06T00:36:25.227148+00:00 app[web.1]: npm ERR! missing script: start
2017-03-06T00:36:25.229125+00:00 app[web.1]: npm ERR!
2017-03-06T00:36:25.255906+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-03-06T00:36:25.229286+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
@Sara3
Sara3 / DFS on BT
Created April 4, 2017 23:05
For RC
#include <iostream>
#include <iomanip>
#include <stack>
using namespace std;
class Tree{
public:
//create each node
var f = function(n) {
var f = 1;
for (var i = 1; i <= n; i ++) {
f = f*i;
}
return f;
}
console.log(f(4))
class CashAmount{
constructor(amount) {
this.amount = amount;
this.pennies = this.amount * 100;
}
addDoubleAmount (newAdd) {
this.amount += newAdd;
this.pennies += newAdd*100;
}
/**
* @param {number[]} nums
* @return {number[]}
*/
var productExceptSelf = function(nums) {
//i: array
let output = []
//need to handle division by 0 [1, 0] => [0, 1]
// need to handle division by -number [9,0,-2] => [0,-18,0]
//
var messageBus = {
subscrib: function(str, callback) {
// make a key in the parent object
if (!this[str]) {
this[str] = [];
this[str].push(callback)
} else {
this[str].push(callback)
}
/*
Install mysql -> https://dev.mysql.com/doc/mysql-osx-excerpt/5.5/en/osx-installation-pkg.html
run the server
log in with 'root' user
log in with mysql -u root -p;
create a super user like (https://dev.mysql.com/doc/refman/5.5/en/adding-users.html)
in another termilal log in with the user info. 'sara'
mysql -u sara -p;