LeetCode: 1446-Consecutive Characters
題目
The power of the string is the maximum length of a non-empty substring that contains only one unique character. Given a string s, return the power of s.Read More »LeetCode: 1446-Consecutive Characters
The power of the string is the maximum length of a non-empty substring that contains only one unique character. Given a string s, return the power of s.Read More »LeetCode: 1446-Consecutive Characters
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.
Read More »LeetCode: 1290-Convert Binary Number in a Linked List to IntegerThe Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, return the Hamming distance between them.Read More »LeetCode: 461-Hamming Distance 解題紀錄
Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.)
Read More »LeetCode: 24-Swap Nodes in Pairs 解題紀錄You are given an array of k
linked-lists lists
, each linked-list is sorted in ascending order.
You are given an array prices where prices[i] is the price of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.
Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.
Read More »LeetCode: 121-Best Time to Buy and Sell Stock 解題紀錄