leetcode伪代码-convert-binary-number-in-a-linked-list-to-integer:将链表中的二进制数

时间:2021-06-30 19:58:32
【文件属性】:
文件名称:leetcode伪代码-convert-binary-number-in-a-linked-list-to-integer:将链表中的二进制数
文件大小:4KB
文件格式:ZIP
更新时间:2021-06-30 19:58:32
系统开源 leetcode伪代码convert-binary-number-in-a-linked-list-to-integer 题目解读: 题目来源: 原文: Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the binary representation of a number. Return the decimal value of the number in the linked list. 解读: 给定一个链节串列的起始节点head 每个串列节点的值都是0或是1 代表二元数的位元 举例来说就是1->0->1 => b101 = 1* 2^2+ 0* 2^1 + 1* 2^0 = 4 + 0 + 1 =5 求解每个链节串列所代表的10进制的值 初步解法: 初步观察: 首先这个链节串列是从最高的digits往后排 因此无法直接递加 递加必须等到走完所
【文件预览】:
convert-binary-number-in-a-linked-list-to-integer-master
----getDecimalValue_test.go(1KB)
----.gitignore(269B)
----README.md(3KB)
----getDecimalValue.go(346B)

网友评论