循环结构 while 循环 while是最基本得循环,它的结构为: while(布尔表达式){ //循环内容 } 只要布尔表达式为true,循环就会一直执行下去 public class WhileDemo01 { public static void main(String[] args) { / ...
分类:
编程语言 时间:
2021-04-06 14:10:11
阅读次数:
0
题目链接 解题思路:双指针 C++: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} ...
分类:
其他好文 时间:
2021-04-06 14:05:05
阅读次数:
0
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
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
#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
题目描述 题干: 写一个程序,输出从 1 到 n 数字的字符串表示。 1. 如果 n 是3的倍数,输出“Fizz”; 2. 如果 n 是5的倍数,输出“Buzz”; 3.如果 n 同时是3和5的倍数,输出 “FizzBuzz”。 实例: n = 15, 返回: [ "1", "2", "Fizz", ...
分类:
其他好文 时间:
2021-04-05 12:31:23
阅读次数:
0
声明:图片及内容基于:https://www.bilibili.com/video/BV16C4y1H7Zc?from=articleDetail 最短路径 Dijkstra算法 原理 数据结构 核心代码 findMinDist() int MGraph::findMinDist(){ int le ...
分类:
编程语言 时间:
2021-04-05 12:28:03
阅读次数:
0
关键字联想词优化方案 Redis + Trie树 4.4.1现有问题 每次输入关键字的时候都会调用后台获取数据,频繁的发起请求查询数据库,并且是模糊查询 随着联想词的搜索越来越频繁,每次从数据库查询非常占用数据库资源,同时查询效率比较低 4.4.2 优化方案Trie树 优化方案: 数据能够缓存到re ...
分类:
其他好文 时间:
2021-04-05 12:26:58
阅读次数:
0
有n个交汇点和m条双向道路,一个人可以凭借现有的通道从一个点到达另一个点。确定这样一种方案,使每条道路改为单向行驶,但仍满足能够从任意一个点到达另一任意点的要求 ...
分类:
其他好文 时间:
2021-04-05 12:19:33
阅读次数:
0