Skip to content

Instantly share code, notes, and snippets.

View pancanin's full-sized avatar
🤠
Hiiihaaaw

pancanin

🤠
Hiiihaaaw
View GitHub Profile
@pancanin
pancanin / rust.cpp
Created March 8, 2024 14:04
Simulation of metal piece rusting
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_set>
static const int dim = 10;
std::string readLine(std::istream& in) {
std::string str;
@pancanin
pancanin / character-finder.cpp
Created March 8, 2024 13:19
Program for finding words that contain a specific character
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_set>
std::string readLine(std::istream& in) {
std::string str;
std::getline(in, str);
return str;
@pancanin
pancanin / day.cpp
Created December 12, 2023 22:24
Advent of Code - Day 2
#include <iostream>
#include <fstream>
#include <string>
#include <ctype.h>
#include <vector>
#include <sstream>
using namespace std;
struct Game {
@pancanin
pancanin / day1.cpp
Created December 12, 2023 08:34
Advent Of Code - Day 1
#include <iostream>
#include <fstream>
#include <string>
#include <ctype.h>
#include <math.h>
using namespace std;
int main()
{
#include <iostream>
#include <vector>
#include <math.h>
#include <unordered_map>
#include <string>
#include <fstream>
#include <stack>
#include <unordered_set>
#include <queue>
#include <stack>
@pancanin
pancanin / ClosestPoint2D.cpp
Created September 19, 2022 07:22
Closest 2 points in 2D space
// Example program
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
using namespace std;
struct Point {
int x;
@pancanin
pancanin / dijkstra.cpp
Created September 14, 2022 12:12
Dijkstra shortest path
#include <iostream>
#include <vector>
#include <math.h>
#include <unordered_map>
#include <string>
#include <fstream>
#include <stack>
#include <unordered_set>
#include <queue>
#include <stack>
@pancanin
pancanin / dfs-all-paths-dest.cpp
Last active August 29, 2022 08:57
DFS All paths to destination
#include <iostream>
#include <vector>
#include <math.h>
#include <unordered_map>
#include <string>
#include <fstream>
#include <stack>
using namespace std;
unordered_map<int, vector<int>> graph;
#include <iostream>
#include <vector>
#include <future>
#include <unordered_map>
#include <unordered_set>
using namespace std;
/* A DS for finding the root node of a vertex in a tree.
!Does not keep track of the original tree structure so it cannot be reconstructed exactly. */
@pancanin
pancanin / ShoppingList.cpp
Created January 4, 2022 00:21
Code kata for a order list
#include <iostream>
#include <cstdint>
#include <vector>
#include <limits>
#include <cstring>
#include <sstream>
#include <chrono>
#include <set>
#include <stack>
#include <map>