public class Solution {
public boolean canJump(int[] nums) {
int n = nums.length;
int rightmost = 0;
for (int i =...
class Solution {
public:
int numSquares(int n) {
vector<int> f(n + 1);
for (int i = 1; i <= n; i++) {
...
class Solution {
public:
int maxArea(vector<int>& height) {
int l = 0, r = height.size()-1;
int ans = 0;
...
class Solution {
public:
int maxProduct(vector<int>& nums) {
//f1,f2:以第i个数结尾的乘积最大,最小的子数组乘积。
//最小的对应负数的情况,负负得正。
...
class Solution {
public:
int longestConsecutive(vector<int>& nums) {
unordered_set<int>se;
for(int x: num...
class Solution {
public:
int maxProfit(vector<int>& prices) {
if(prices.size()==0)return 0;
//f[i]到第i天为止的最大收益。
...
//f[i][j]表示s的前i个能否被p的前j个匹配。
//转移若s[i]==p[j]则f[i][j]=f[i-1][j-1]. 否则若p[j]=.也可以匹配,若=*则再判断p[j-1]与s[i]的关系
class Solution {
public:
bool isMat...
class Solution {
public:
vector<int> findAnagrams(string s, string p) {
int slen = s.size(), plen = p.size();
if(sl...
class Solution {
public:
int trap(vector<int>& height) {
int ans = 0;
int left = 0, right = height.size() - 1;
...
class Solution {
public:
int countSubstrings(string s) {
int n = s.size(), ans = 0;
for(int i = 0; i < 2*n-1; i++){
...
class Solution {
public:
int longestValidParentheses(string s) {
int ans = 0;
stack<int>stk;
stk.push(-1);...
class Solution {
public:
vector<int> dailyTemperatures(vector<int>& temperatures) {
int n = temperatures.size();
...
class Solution {
public:
vector<double> calcEquation(vector<vector<string>>& equations, vector<double>& val...
class Solution {
public:
bool check(string s){ //判断序列是否合法
int cc = 0;
for(char ch : s){
if(ch=='(')cc++;
...
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNo...
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNo...
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNo...
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNo...
#include <iostream>
using namespace std;
int main() {
long long int n, count = 0;
cin >> n;
for (long long...
#include<bits/stdc++.h>
using namespace std;
const int dir[8][2] = { {1,2},{1,-2},{2,1},{2,-1},{-1,2},{-1,-2},{-2,1},{-2,-1} };
bool d[3...
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int dx[4] = { 0,0,1,-1 };
int dy[4] = { 1,-1,0,0 ...
#include<iostream>
#include<cstdio>
#define N 205
using namespace std;
int n, m;
int a[N];
int f[N][N];//邻接矩阵存边
inline void up...
#include <bits/stdc++.h>
#define int long long
#define PII pair<int,int>
#define MP make_pair
#define INF LONG_LONG_MAX
using ...
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define MEM(arr,num) memset(arr,num,sizeo...
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
int n;
std::s...
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
#define MAXL 100010
int N, M, A[MAXL];
v...
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int ans;
char str1[233]...
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
set<int>s;
set<...
#include<bits/stdc++.h>
using namespace std;
int main() {
string n;
int s, i;
cin >> n >> s;
while (s) {
...
#include<bits/stdc++.h>
using namespace std;
string str[20];
int use[20], length = 0, n;
int canlink(string str1, string str2) {
for ...