方式一(将整数转换为字符串,在转换为字符数组): public boolean isPalindrome(int x) { if (x < 0) { return false; } char[] chars = new String(Integer.toString(x)).toCharArray( ...
分类:
其他好文 时间:
2021-04-08 13:10:24
阅读次数:
0
二叉树——102. 二叉树的层序遍历 题目: 思路: 就是层序遍历,一层层扫下去,然后通过队列去实现,一个队列先暂存这一层的所有结点,然后另一个队列通过push_back的方式,实现从左到右的访问。 代码: class Solution { public: vector<vector<int>> l ...
分类:
其他好文 时间:
2021-04-08 12:59:26
阅读次数:
0
比较for和while 代码比较复制代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 public class HelloWorld { public static void main(String[] args) { //使用while打印0到4 int i = ...
分类:
其他好文 时间:
2021-04-08 12:54:22
阅读次数:
0
package com.easyagu.liwei.list;import redis.clients.jedis.Jedis;/** * 秒杀案例 */public class SeckillDemo { public static void main(String[] args) { Secki ...
分类:
其他好文 时间:
2021-04-07 11:07:01
阅读次数:
0
class Solution { public: int searchInsert(vector<int> &nums, int target) { int low = 0; int high = nums.size() - 1; //为了严谨 <= while (low <= high) { in ...
分类:
其他好文 时间:
2021-04-07 10:57:40
阅读次数:
0
关于此题有一种精简的写法。 首先我们分析题面,可以发现如果最后可以达到使 \(1\) 到 \(n\) 的路径距离都相等,那么从 \(1\) 到任意一个 \(1\) 到 \(n\) 的路径上的节点的路径也都相等。所以我们设 \(dis[u]\) 为 \(1\) 到 点 \(u\) 的路径长度,\(di ...
分类:
其他好文 时间:
2021-04-07 10:37:30
阅读次数:
0
procedure TPageListDialogFrame.ListView1ScrollViewChange(Sender: TObject); var allheight: real; begin with Sender as TListView do begin allheight := S ...
分类:
其他好文 时间:
2021-04-07 10:29:44
阅读次数:
0
问题: 合并两个有序链表 链表L1: 1->2->4->9 链表L2: 3->5>6->10->13 合并后:1->2->3->4->5->6->9->10->13 1. 准备数据结构 及测试数据 Node节点 public class Node { public Integer value; pu ...
分类:
其他好文 时间:
2021-04-06 14:50:49
阅读次数:
0
在测试过程当中,测试数据往往会与代码进行分离,进行独立存储。存储或获取测试数据的方式有很多,如excel文件中、txt文件中、yaml文件中、或者从数据库中读取。今天我们要说的就是怎样从yaml文件中获取数据。 一、认识python中的yaml库安装:安装包名是pyyaml导入:import yam ...
分类:
其他好文 时间:
2021-04-06 14:45:44
阅读次数:
0
Shortcut Keys Configure Summary You can use shortcut keys to quickly insert or modify styles or do other operations supported by Typora. You can find ...
分类:
其他好文 时间:
2021-04-06 14:21:02
阅读次数:
0