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> | |
#include <algorithm> | |
#include <stack> | |
using namespace std; | |
class Capcity { | |
private: |
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> | |
#include <algorithm> | |
#include <stack> | |
using namespace std; | |
class Capcity { | |
private: |
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> | |
#include <algorithm> | |
using namespace std; | |
class Capcity { | |
private: | |
void dfs(vector<vector<int>>& graph, int root, vector<bool>& visited, vector<int>& cache) { |
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> | |
using namespace std; | |
class SlidingPuzzle { | |
private: | |
vector<int> bitree; | |
int lowbit(int x) { | |
return x & (-x); | |
} |
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> | |
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) { |
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_map> | |
#include <unordered_set> | |
#include <queue> | |
#include <algorithm> | |
#include <sstream> | |
using namespace std; |
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_map> | |
#include <unordered_set> | |
#include <queue> | |
#include <algorithm> | |
using namespace std; | |
struct State { |
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_map> | |
#include <queue> | |
#include <algorithm> | |
using namespace std; | |
struct State { | |
int key; |
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
class Solution { | |
private: | |
struct State { | |
string key; | |
vector<int> board; | |
vector<int> indices; | |
}; | |
string encode(vector<int>& vec) { | |
string result = ""; |
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
class Solution { | |
private: | |
struct State { | |
string key; | |
vector<int> board; | |
vector<int> indices; | |
}; | |
string encode(vector<int>& vec) { | |
string result = ""; |
NewerOlder