long long myPow(long long x, int n) { long long ans = 1; while(n){ if(n % 2 != 0){ ans *= x; ans %= modN; } x *= x; x %= modN; n /= 2; } return ans; } ...
分类:
其他好文 时间:
2021-04-08 13:55:01
阅读次数:
0
问题场景 jackson可以将多态类型JSON序列化. 但在反序列化时会因为找不到具体的类而失败. 举例:创建4个POJO类 @Data public class AbstractTarget { } @Data @EqualsAndHashCode(callSuper = true) class ...
分类:
Web程序 时间:
2021-04-08 13:32:22
阅读次数:
0
方式一(将整数转换为字符串,在转换为字符数组): 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
问题1:tsx文件找不到 根目录新建一个tsconfig.json { "compilerOptions": { "jsx": "react", "outDir": "./dist", "module": "es6", "target": "es5", "allowJs": true, "allow ...
分类:
其他好文 时间:
2021-04-07 11:32:12
阅读次数:
0
#dfs的模板 注意bool判断是否走过这个点并注意回溯的处理。 注意条件判断和边界问题。 //边界判断即剪枝 if(chk()) return; if(over(BianJie)) return; if(bool = false)//未搜索过 bool = true; //赋值或纪录 dfs(n ...
分类:
编程语言 时间:
2021-04-07 11:21:16
阅读次数:
0
// 统计数组中 相同值出现的次数 var ary = [1,2,1,1,1,2,3] let obj = {} for(let i = 0 ; i < ary.length; i++) { if(obj[ary[i]]){ //如果obj中有值, +1 (如果数组中有值 是0,注意true 和 f ...
分类:
编程语言 时间:
2021-04-07 11:17:33
阅读次数:
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