Skip to content

Instantly share code, notes, and snippets.

Avatar

sahilalipuria

View GitHub Profile
@sahilalipuria
sahilalipuria / UncrossedLines.java
Created May 25, 2020
Uncrossed Lines in Java through Dynamic Programming
View UncrossedLines.java
public static int maxUncrossedLines(int[] A, int[] B) {
int result = 0;
int dpTable[][] = new int[A.length+1][B.length+1];
for(int i=0;i<=A.length;i++)
dpTable[i][0] = 0;
for(int i=0;i<=B.length;i++)
View ConsistentHashing.java
import java.util.SortedMap;
import java.util.TreeMap;
public class ConsistentHashing {
// Consistent Hashing with Ring having 50 buckets.
final static int LIMIT = 50;
// Sorted Map.
final static SortedMap<Integer, String> bucketIdToServer = new TreeMap<>();
@sahilalipuria
sahilalipuria / PythonSimpleWebsocket
Created May 18, 2016 — forked from rich20bb/PythonSimpleWebsocket
Simple websocket server in Python. Echos back whatever is received. Works with Chome, Firefox 16, IE 10.
View PythonSimpleWebsocket
import time
import struct
import socket
import hashlib
import base64
import sys
from select import select
import re
import logging
from threading import Thread
@sahilalipuria
sahilalipuria / index.html
Created May 17, 2016 — forked from piatra/index.html
Record stream from getUserMedia() stream
View index.html
<!DOCTYPE HTML>
<html>
<head>
<title>Video recording demo</title>
<link rel="stylesheet" type="text/css" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
@sahilalipuria
sahilalipuria / websocketserver.py
Created May 11, 2016 — forked from mumrah/websocketserver.py
Simple WebSockets in Python
View websocketserver.py
import time
import struct
import socket
import hashlib
import sys
from select import select
import re
import logging
from threading import Thread
import signal
@sahilalipuria
sahilalipuria / .gitignore
Created May 5, 2016 — forked from zed/.gitignore
WebSocket Echo :python:twisted:txws:jquery:
View .gitignore
/twistd.pid
/_trial_temp/
@sahilalipuria
sahilalipuria / Rotate a Linked List Counter Clockwise by k nodes
Created Sep 16, 2012
Rotate a Linked List Counter Clockwise by k nodes
View Rotate a Linked List Counter Clockwise by k nodes
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct node{
int data;
node *link;
}*start=NULL,*p,*q,*r,*temp;
void insert(int val)
You can’t perform that action at this time.