php - Add Two Numbers

php - Add Two Numbers

今天用php來改寫吧! Let’s Go!!! 題目為 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 contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Example 1 : Input: l1 = [2,4,3], l2 = [5,6,4] Output: [7,0,8] Explanation: 342 + 465 = 807. [閱讀全文]

golang - Add Two Numbers

golang - Add Two Numbers

今天寫的題目跟昨天一樣 不過我們來改為用Golang 寫吧! 題目為 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 contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Example 1 : Input: l1 = [2,4,3], l2 = [5,6,4] Output: [7,0,8] Explanation: 342 + 465 = 807. [閱讀全文]

一日一LeetCode 計畫

C# - Add Two Numbers

今天開始來實行一日一 LeetCode 計畫,除了讓自己更熟悉語言外,也想多練習更多的演算法 一開始也想不到要寫什麼side project 那麼就來刷刷 LeetCode 吧 從一開始註冊到現在也過了超久的(我就懶) 接下來會利用各種不同的語言寫同一個題目 目前計畫的有 C# , golang , php , typescript 希望能持續進步這些語言 話不多說我們就開始吧 題目為 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 contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. [閱讀全文]