Skip to content

Instantly share code, notes, and snippets.

@itayB
itayB / findWaterInGlass.cpp
Created September 21, 2016 17:34
Program to find amount of water in a given glass
#include <iostream>
#include <string>
using namespace std;
int main() {
int input = 2;
int tmp;
for (tmp=1 ; tmp <= input ; tmp *= 2);
@itayB
itayB / letterGame.cpp
Created September 21, 2016 14:00
Task: Letter Game (International Olympiad in Informatics)
// ref: http://ioinformatics.org/locations/ioi95/contest/tasks/lgame.shtml
// PLEASE NOTICE THAT THIS IS A SOLUTION FOR THE FIRST STEP ONLY !
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
@itayB
itayB / question.md
Last active September 21, 2016 13:01
Task: Word Chains (International Olympiad in Informatics)

Task: Word Chains

A word consists of at least one and at most 75 lowercase letters (from a to z). A list of one or more words is called a chain when each word in that list, except the first, is obtained from the preceding word by appending one or more letters on the right. For instance, the list

i
in
int
integer
@itayB
itayB / latency.txt
Created September 20, 2016 14:01 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@itayB
itayB / DijkstraMatrixRep.cpp
Created September 19, 2016 13:46
Dijkstra (Matrix graph representation)
#include <iostream>
#include <limits>
// ref: http://www.geeksforgeeks.org/printing-paths-dijkstras-shortest-path-algorithm/
using namespace std;
#define V 9
/* Recursive print. */
#include <iostream>
#include <stdexcept>
using namespace std;
template <class T> class CircularArray {
private:
int size;
int head;
T* arr;
#include <iostream>
#include <vector>
#include <string>
using namespace std;
vector<char*>* powerSet(char* src) {
if (strlen(src) == 0) {
vector<char*>* ret = new vector<char*>();
ret->push_back("");
#include <iostream>
#include <vector>
#include <string>
using namespace std;
void print(vector<int>& v) {
string s = "[";
for (int i=0 ; i < v.size() ; i++) {

Written by Itay Bittan.

Interview Questions

Recently I've started to interview - looking for my next work place. I'll share some of the resource I'm using - hopping that could help others in their next challenge as well.

  1. The book Cracking The Coding Interview is one of the best resource I've found (search for the PDF version).
  2. HIRED IN TECH.
  3. Geeks for Geeks - A computer science portal for geeks.
@itayB
itayB / NodeJs.md
Last active August 26, 2016 14:58

Written by Itay Bittan.

Node.js

Background / Motivation

Our primary product contains Apache web server using c-modules. The reason of choosing Apache initially was due to:

  1. License
  2. It's popularity - as you can see here.
  3. C language support - allow our developers to keep working in their well known environment (the entire system was written in C primarily).