题目描述很清楚,最容易想到的就是从前往后一次相加即可。 题中所给的数据结构描述: 第一次的算法: class Solution { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode res=new ListNode( ...
分类:
其他好文 时间:
2020-02-10 22:56:54
阅读次数:
120
Given an array nums of integers, return how many of them contain an even number of digits. Example 1: Input: nums = [12,345,2,6,7896]Output: 2Explanat ...
分类:
其他好文 时间:
2020-02-10 17:53:55
阅读次数:
65
Python函数中的必选/默认/可变/关键字/命名参数 一、默认参数 n为默认参数,直接赋值 默认参数设置的两个注意事项: 1.必选参数在前,默认参数在后,否则会报错 2.当函数有多个参数时,把变化大的参数放前面,变化小的参数放后面。变化小的参数就可以作为默认参数。 二、可变参数 在python中, ...
分类:
编程语言 时间:
2020-02-10 11:59:57
阅读次数:
91
it ('should add two numbers', () => { const logger = jasmine.createSpyObj('LoggerService', ['log']) // logger.log.and.returnValue(); const calculator ...
分类:
其他好文 时间:
2020-02-10 09:52:34
阅读次数:
50
isa初始化 isa的结构 union isa_t { isa_t() { } isa_t(uintptr_t value) : bits(value) { } Class cls; uintptr_t bits; #if defined(ISA_BITFIELD) struct { ISA_BIT ...
分类:
移动开发 时间:
2020-02-10 09:23:22
阅读次数:
99
Problem : Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, gi ...
分类:
其他好文 时间:
2020-02-10 00:20:24
阅读次数:
81
题目如下: Given two numbers, hour and minutes. Return the smaller angle (in sexagesimal units) formed between the hour and the minute hand. Example 1: Inp ...
分类:
其他好文 时间:
2020-02-09 18:15:29
阅读次数:
313
素数判定 题目分析: 构造一个判断素数的函数fun,利用fun函数判断区间内的素数。 代码: #include <iostream> #include <math.h> #define fun(n) n*n + n + 41 using namespace std; int prime(int n) ...
分类:
其他好文 时间:
2020-02-08 09:35:06
阅读次数:
74
PAT 甲级 Advanced 1023 Have Fun with Numbers (20) [?整数运算] ...
分类:
其他好文 时间:
2020-02-06 16:49:31
阅读次数:
63
无语,15步产生16个数,植树原理啊! 大水题,居然wa了好几次,唉,自己的问题。 略略略,就要封装成结构体,略略略。 1 #include <set> 2 #include <map> 3 #include <cmath> 4 #include <queue> 5 #include <vector ...
分类:
编程语言 时间:
2020-02-06 14:24:32
阅读次数:
61