260409
260409

260409

  • AutoBuilder

Cursor is incredibly good harness.

Opus is also not Oputhetic anymore

Backlinks (0)

No backlinks found.

260618
260618

260618

컴퓨트로늄 컴퓨트로늄

Backlinks (0)

No backlinks found.

Debian Setup
Debian Setup

Debian Setup

sudo apt update && sudo apt install git && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && echo >> ~/.bashrc && echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)"' >> ~/.bashrc && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)" && sudo apt-get install build-essential && brew install gcc btop
Backlinks (1)
  • 260415
Definition for singly-linked list.
Definition for singly-linked list.

Definition for singly-linked list.

Solved at: 220925

Question

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.

The most significant bit is at the head of the linked list.

Solution

python
# Definition for singly-linked list.# class ListNode:#     def __init__(self, val=0, next=None):#         self.val = val#         self.next = nextclass Solution:    def getDecimalValue(self, head: ListNode) -> int:        value = head.val        while head.next:            value *= 2            head = head.next            value += head.val        return value

Results

Runtime

  • 60 ms, faster than 28.54% of Python3 online submissions for Convert Binary Number in a Linked List to Integer.

Memory Usage

  • 13.9 MB, less than 9.10% of Python3 online submissions for Convert Binary Number in a Linked List to Integer.

Complexity Analysis

  • Time complexity: O(n)O(n)O(n)
  • Space complexity: O(1)O(1)O(1)
Backlinks (2)
  • 220925
  • Coding Tests
Index
cho.sh
I prefer CLIBB9A08260619260619컴퓨트로늄37A88F컴퓨트로늄0CF03F컴퓨트로늄2C60FB260618260618260418260418260528260528AutoBuilder63849A260419260419Setup9AC296StellaD226F7260415260415Debian SetupD2F701260414260414anaclumos/configs/AGENTS.mdED86A3Ramp의 AX (회사를 AI로 물들이는 법)840774260413260413How to get your company AI pilled46544C260411260411260409260409260407260407260406260406Separating Claude Code Personal Sub and Claude Code Company Sub33A53C
sudo apt update && sudo apt install git && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && echo >> ~/.bashrc && echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)"' >> ~/.bashrc && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)" && sudo apt-get install build-essential && brew install gcc btop
Warning
This post is more than a year old. Information may be outdated.
# Definition for singly-linked list.# class ListNode:#     def __init__(self, val=0, next=None):#         self.val = val#         self.next = nextclass Solution:    def getDecimalValue(self, head: ListNode) -> int:        value = head.val        while head.next:            value *= 2            head = head.next            value += head.val        return value