Skip to content

Instantly share code, notes, and snippets.

View fwang49asu's full-sized avatar

Feng Wang fwang49asu

View GitHub Profile
@fwang49asu
fwang49asu / 1.1.0.patch
Created September 8, 2016 18:48
1.1.0 patch for archlinux rapidjson package: https://aur.archlinux.org/packages/rapidjson/
commit 9d5cea1417cc2bc6918cb58b87ed92c6f95ea6c6
Author: Feng Wang <fwang49@asu.edu>
Date: Thu Sep 8 11:42:44 2016 -0700
update to 1.1.0
diff --git a/PKGBUILD b/PKGBUILD
index c0d677f..b18dc32 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@fwang49asu
fwang49asu / LC269_DFS.cpp
Created March 10, 2019 02:17
Leetcode 269 DFS
class Solution {
private:
string compare(string& a, string& b) {
int n = min(a.length(), b.length());
for (int i = 0; i < n; ++i) {
if (a[i] != b[i]) {
string result = "";
result.push_back(a[i]);
result.push_back(b[i]);
return result;
@fwang49asu
fwang49asu / LC269_BFS.cpp
Created March 10, 2019 02:20
Leetcode 269 BFS
class Solution {
private:
string compare(string& a, string& b) {
int n = min(a.length(), b.length());
for (int i = 0; i < n; ++i) {
if (a[i] != b[i]) {
return {a[i], b[i]};
}
}
return "";
@fwang49asu
fwang49asu / UVA_872_Ordering.cpp
Last active March 10, 2019 06:03
UVA 872 Ordering
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
class Ordering {
private:
bool toposort(string& dict, vector<string>& graph, vector<int>& indegrees, string& cache) {
@fwang49asu
fwang49asu / LC773_BFS_1.cpp
Created March 10, 2019 07:11
Leetcode 773 BFS_1
class Solution {
private:
struct State {
string key;
vector<int> board;
vector<int> indices;
};
string encode(vector<int>& vec) {
string result = "";
class Solution {
private:
struct State {
string key;
vector<int> board;
vector<int> indices;
};
string encode(vector<int>& vec) {
string result = "";
#include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
#include <algorithm>
using namespace std;
struct State {
int key;
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
using namespace std;
struct State {
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <sstream>
using namespace std;
#include <iostream>
#include <vector>
using namespace std;
class SlidingPuzzle {
private:
int inversions(vector<int>& board) {
int result = 0;
for (int i = 0; i < board.size(); ++i) {
for (int k = i + 1; k < board.size(); ++k) {