This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.*; | |
//net.InetAddress; | |
//net.DatagramPacket; | |
//net.DatagramSocket; | |
import java.util.*; | |
import java.io.*; | |
//io.File; | |
class Receiving extends Thread { | |
//constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.*; | |
import java.util.*; //for ArrayList and Date | |
import java.io.*; | |
class ConnectionThread extends Thread { | |
Socket client; //class member | |
int counter; //class member | |
//constructor | |
public ConnectionThread(Socket cl, int c) { | |
client = cl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
# Read file | |
input = open("input.txt") | |
rows = [] | |
for line in input.readlines(): | |
rows.append(line[0: -1]) | |
input.close() | |
# for row in rows: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask import request | |
app = Flask(__name__) | |
#Normally this would be an external file like object, but here | |
#it's inlined | |
FORM_PAGE = """ | |
<html> | |
<head> | |
<title>Flask Form</title> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stack> | |
using namespace std; | |
class MyStack | |
{ | |
private: | |
stack<int> s; | |
stack<int> min; | |
public: | |
void push(int v) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <unordered_set> | |
using namespace std; | |
void two_sum(int array[], int sum) | |
{ | |
unordered_set<int> us; | |
vector<int> v (array, array+7); | |
for (int i = 0; i < v.size(); i++) { | |
if (us.find(sum - array[i]) == us.end()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stack> | |
using namespace std; | |
class MyQueue | |
{ | |
private: | |
stack<int> in; | |
stack<int> out; | |
public: | |
void push(int v) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <stack> | |
using namespace std; | |
class SetOfStacks //stacks managed by vector | |
{ | |
private: | |
int capacity; | |
vector<stack<int>> vs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stack> | |
using namespace std; | |
/* | |
s: | |
2 | |
8 | |
9 | |
3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stack> | |
using namespace std; | |
class Node | |
{ | |
public: | |
int value; | |
Node *next; | |
Node(int v) : value(v) {} | |
}; |
OlderNewer