1、(1)定义一个汽车类Vehicle,要求如下:(知识点:类的继承 方法的覆盖) (a)属性包括:汽车品牌brand(String类型)、颜色color(String类型)和速度speed(double类型)。 (b)至少提供一个有参的构造方法(要求品牌和颜色可以初始化为任意值,但速度的初始值必须 ...
分类:
其他好文 时间:
2020-05-14 13:01:44
阅读次数:
48
剑指Offer-面试题15 二进制中1的个数 二进制中1的个数 https://leetcode-cn.com/problems/er-jin-zhi-zhong-1de-ge-shu-lcof/ 使用一个位运算的小技巧即可。 public int HammingWeight(uint n) { i ...
分类:
其他好文 时间:
2020-05-14 11:32:43
阅读次数:
59
单向循环链表的操作 travel() 遍历链表中所有元素 思路:跟之前的单链表一样,循环输出即可;要注意的是最后一个节点时,此时cur.next指向头节点,而没有进入循环,而cur指向该节点,跳出循环后,单独把最后一个节点的元素打印出来就可以了(当链表中只有一个元素,也可以处理) 注意:同时也要考虑 ...
分类:
其他好文 时间:
2020-05-14 10:30:51
阅读次数:
64
list1 = [1, 2, 3, 1, 2, 3, 4, "三国演义", "西游记", "三国演义", "红楼梦"] # 对列表去重,方法一:采用set() # 此方法得出的列表的顺序是无序的,单纯的去重可行;如果需求是去重后按照顺序展示则不推荐。 list2 = list(set(list1)) ...
分类:
其他好文 时间:
2020-05-14 01:21:56
阅读次数:
70
1、split() 在遇到 * ^ | 等符号时需要转义字符 \\ public class testSplit { public static void main(String[] args) { String a1 = "1^6^3^5"; String[] m1 = a1.split("\\^ ...
分类:
其他好文 时间:
2020-05-13 19:50:08
阅读次数:
52
#include<iostream> using namespace std; int main() { cout << "sizeof(int*)="<<sizeof(int*) << endl; cout << "sizeof(int)=" << sizeof(int) << endl; } c ...
分类:
其他好文 时间:
2020-05-13 19:49:30
阅读次数:
68
定义字典 familyinfo = { "family name":"Python", "family structure":[ {"name":"Taro", "age":32, "sex":"male"}, {"name":"Hanako", "age":31, "sex":"female"}, ...
分类:
编程语言 时间:
2020-05-13 12:05:46
阅读次数:
100
yum查找可安装的软件包 yum search xxx 查看ansible的所有版本 yum --showduplicates list ansible ...
分类:
系统相关 时间:
2020-05-13 12:05:31
阅读次数:
65
class User extends Model { // 定义时间戳字段名 protected $createTime = 'create_at'; protected $updateTime = 'update_at'; } 下面是修改字段后的输出代码: $user = new User(); ...
分类:
其他好文 时间:
2020-05-13 11:59:39
阅读次数:
60
问题: 给定两个大小相同,由0和1构成的N*N矩阵。求将其中一个矩阵进行水平垂直平移,最终两个矩阵重叠(1)的最大面积为多少。 Example 1: Input: A = [[1,1,0], [0,1,0], [0,1,0]] B = [[0,0,0], [0,1,1], [0,0,1]] Outp ...
分类:
其他好文 时间:
2020-05-13 11:49:17
阅读次数:
39