Skip to content

Instantly share code, notes, and snippets.

View honghaoz's full-sized avatar
:shipit:
shipit

Honghao honghaoz

:shipit:
shipit
View GitHub Profile
@honghaoz
honghaoz / String-CheckUniqueCharacters.cpp
Last active August 29, 2015 14:02
Check whether characters are unique in a string
#inlcude <cstring>
#include <iostream>
#include <set>
#include <cstring>
using namespace std;
bool checkUniqueChars(char *str) {
char *strP = str;
set<char> testSet;
pair<set<char>::iterator, bool> result;
@honghaoz
honghaoz / String-ReverseString.cpp
Last active August 29, 2015 14:02
ReverseAString
#include<iostream>
using namespace std;
void reverse(char a[]) {
int length = strlen(a);
char temp;
for (int i = 0; i < length / 2; i++) {
temp = a[i];
a[i] = a[length - 1 - i];
a[length - 1 - i] = temp;
import java.io.*;
import java.util.*;
/**
* https://class.coursera.org/algo/quiz/attempt?quiz_id=52
*/
public class MinCut {
private static class Graph {