Skip to content

Instantly share code, notes, and snippets.

/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
class Solution
{
public:
vector<string> generateParenthesis(int n)
{
vector<string> rst;
string str;
gpdfs(n, n, str, rst);
return rst;
}
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution
{
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
bool isValid(string s)
{
vector<char> queue;
for (auto c : s)
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
vector<vector<int>> fourSum(vector<int> nums, int target)
{
class Solution
{
public:
vector<string> letterCombinations(string digits)
{
if (digits.empty()) return{};
static vector<string>dict = { "", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz" };
vector<string> output;
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int threeSumClosest(vector<int> nums, int target)
{
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<vector<int>> threeSum(vector<int> nums)
{
if (nums.size() < 3) return{};
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
class Solution {
public: