- 博客(11)
- 收藏
- 关注
原创 16. 3Sum Closest
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would ...
2019-09-28 21:38:52 99
原创 python: NameError: name 'cmp' is not defined
python 3.4.3 的版本中已经没有cmp函数,被operator模块代替,在交互模式下使用时,需要导入模块。 lt(a,b) 相当于a<b 从第一个数字或字母(ASCII)比大小 le(a,b)相当于a<=b eq(a,b)相当于a==b 字母完全一样,返回True, ne(a,b)相当于a!=b gt(a,b)相当于a>b ge(a,b)相当于a>...
2019-09-22 14:31:38 3885
原创 python读取文件UnicodeDecodeError: 'gbk' codec can't decode byte 0xfe in position 575056: illegal multiby
open('order.log','r', encoding='UTF-8') 改为 open('order.log','rb')
2019-09-22 13:50:52 433
原创 JS获取HTML插入template的DOM节点
<template id="test"> </template> let indexDoc = document; let currentDoc = indexDoc.currentScript.ownerDocument; let temp = currentDoc.getElementById("test");
2019-09-21 22:45:42 1180
原创 Ubuntu系统su出现:Authentication failure的解决办法
$ sudo passwd root Enter new UNIX password: //此时输入你的密码 Retype new UNIX password: //再次输入,相同密码。 passwd: password updated successfully
2019-09-20 15:53:52 245
原创 JS交换两个变量的值
let num1 = 5, num2 = 6; num1 = [num2, num2 = num1][0]; console.log(num1, num2);
2019-09-14 21:22:02 162
原创 9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanatio...
2019-09-06 11:29:50 116
原创 JS驼峰命名和下划线互转
下划线转换驼峰 function toHump(name) { return name.replace(/\_(\w)/g, function(all, letter){ return letter.toUpperCase(); }); } 驼峰转换下划线 function toLine(name) { return name.replace(/([A-Z])...
2019-09-04 19:12:26 788
原创 4. Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). You may assume nums1 and num...
2019-09-03 16:04:35 82
原创 3. Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: Inpu...
2019-09-03 15:21:30 97
原创 Java8 BigDecimal
在Java的8种基本类型中,我们知道double和float基本数据类型存在着精度缺失问题。我们先来看一个例子。 double augend = 1.0000001; double addend = 0.0000001; double sum = augend + addend; // sum: 1.0000002000000001 System.out.println("sum: " + sum...
2019-09-03 10:01:55 1113 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人