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