Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order
and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Example: Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Output: 7 -> 0 -> 8 Explanation: 342 + 465 = 807.
要求:给到两个非空链表,它们表示两个非负整数。数字以相反的顺序存储它们的每一个节点都包含一位数字。将这两个数字相加并以链表的形式返回。java
编写的代码 https://leetcode.com/submissions/detail/198280812/ : node
class Solution { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode firstNode = new ListNode(-1); ListNode resultNode = firstNode; int nextAddValue = 0, addValue = 0; if (l1 != null || l2 != null) { addValue = l1.val + l2.val; nextAddValue = addValue / 10; resultNode = new ListNode(addValue % 10); l1 = l1.next; l2 = l2.next; firstNode = resultNode; while (l1 != null || l2 != null || nextAddValue != 0) { addValue = nextAddValue; if (l1 != null){ addValue += l1.val; } if (l2 != null){ addValue += l2.val; } nextAddValue = addValue / 10; ListNode resNode = new ListNode(addValue % 10); resultNode.next = resNode; resultNode = resNode; if (l1 != null){ l1 = l1.next; } if (l2 != null){ l2 = l2.next; } } } return firstNode; } }
思路:循环,存在的状况,两个链表长度不同,和的长度不同。git
点评:文章列举了关于在面试的最后一个环节“问面试官问题”的5个最糟糕的问题,以及为何做者会这么认为这些问题很糟糕。在阅读这篇文章的过程当中,最大的感觉是国外表述、说话的思路,理解起来感受很吃力。好比:工具
But as for the worst questions? Oh yeah, that part is easy. And so, I give you my five least favorite questions to be asked in an interview, along with why I think they suck, and what you might ask instead.
学习了jenkins并作了一个小demo。学习
Jenkins是一个开源软件项目,是基于Java开发的一种持续集成工具,用于监控持续重复的工做,旨在提供一个开放易用的软件平台,使软件的持续集成变成可能。spa
关于开发中插件管理的一些小技巧。做为java开发人员,平时咱们在使用的过程当中,确定有接触过很多的插件,或者工具类,不少时候咱们处理了这个问题以后,可能就没管了,当再次遇到一样的问题却依旧须要找好久的资料,这个是很不该该的。因此对于开发人员来讲,但愿本身创建一些本身的工具类,能够方便管理的工具类库。插件
参考了网上的一些资料,经常使用的代码管理工具主要有下面几种:GitHub、SVN、VSS、ClearCase。code
就我本身来讲,我喜欢将一些经常使用的工具类给放到GitHub上,这样方便本身查看和管理。blog