31. 下一个排列 LeetCode_31 题目描述 题解分析 代码实现 class Solution { public void nextPermutation(int[] nums) { int i = nums.length - 2; while(i >= 0 && nums[i] >= nu ...
分类:
其他好文 时间:
2021-04-06 14:03:32
阅读次数:
0
$n$ 个区间,互不相交,$m$ 条线段排好序,一条线段连接两个区间当且仅当线段的两个端点分别在两个相邻的区间内,问是否能将所有区间连通 ...
分类:
其他好文 时间:
2021-04-06 14:02:52
阅读次数:
0
string s; while(getline(cin,s)){ cout<<s<<endl; } ...
分类:
编程语言 时间:
2021-04-06 14:01:34
阅读次数:
0
归并排序模板 code: #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int N = 1e5 + 10; typedef long long ...
分类:
编程语言 时间:
2021-04-05 12:52:30
阅读次数:
0
一 for循环 #for循环可以循环任何序列的项目 for i in range(1,10): for j in range(1,i+1): print('%s*%s=%s'%(i,j,i*j),end="") print() 二 可变不可变类型 #for循环可以循环任何序列的项目 for i in ...
分类:
编程语言 时间:
2021-04-05 12:49:56
阅读次数:
0
#include<bits/stdc++.h> using namespace std; int main(){ char s[105]; int x,y; while(scanf("%d %d",&x,&y)!=EOF){ scanf("%s",s); int ans=0; int len=str ...
分类:
其他好文 时间:
2021-04-05 12:35:26
阅读次数:
0
仅供自己学习 思路: 按照题目要求我们需要定义一个head头节点,并且因为树是二叉搜索树,所以要采取中序遍历才能得到从小到大的排序。 按照中序遍历的模板 dfs(root->left); cout<<root->val; dfs(root->right); 同样我们也通过这个模板写DFS,这里因为是 ...
分类:
其他好文 时间:
2021-04-05 12:33:29
阅读次数:
0
今天刷力扣遇到了这样的问题: 一个整型数组 nums 里除两个数字之外,其他数字都出现了两次。请写程序找出这两个只出现一次的数字。要求时间复杂度是O(n),空间复杂度是O(1)。 之前没有遇到过类似的题型,看到之后很懵,看了题解才知道要用到分组异或的方式进行分组。题解又看了十分钟才终于理解解法的含义 ...
分类:
编程语言 时间:
2021-04-05 12:23:52
阅读次数:
0
基础习题 习题1 请用代码验证'name'是否在字典的键中 info = {'name': '王刚蛋', 'hobby': '铁锤', 'age': '18'} info = {'name': '王刚蛋', 'hobby': '铁锤', 'age': '18'} if info.get('name' ...
分类:
编程语言 时间:
2021-04-05 12:13:50
阅读次数:
0
class Sarr { public: Sarr() { memset(Bit, 0, sizeof(Bit)); } int lowbit(int pos) { return pos & (-pos); } void update(int pos, int len) { while (pos < ...
分类:
编程语言 时间:
2021-04-05 12:05:49
阅读次数:
0