LeetCode: 328-Odd Even Linked List 解題紀錄
題目
Given the head
of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list.
Given the head
of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list.
Given the head
of a singly linked list, return the middle node of the linked list.
If there are two middle nodes, return the second middle node.
Read More »LeetCode: 876-Middle of the Linked List 解題紀錄You are given a 0-indexed integer array nums
of length n
.
The average difference of the index i
is the absolute difference between the average of the first i + 1
elements of nums
and the average of the last n - i - 1
elements. Both averages should be rounded down to the nearest integer.
Given a string s
, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string.
今天在刷題的時候,看到一位分享自己解題思路的網友,他的程式碼中所有宣告的 vector
陣列,全部都使用 emplace_back()
。那時候我可看不明白了,從我在大學上課開始寫時,老師都是教寫 push_back()
的啊?
You are given an integer array matches
where matches[i] = [winneri, loseri]
indicates that the player winneri
defeated player loseri
in a match.
Given an integer array nums
, return the number of all the arithmetic subsequences of nums
.
ou are given two strings s
and t
consisting of only lowercase English letters.
Return the minimum number of characters that need to be appended to the end of s
so that t
becomes a subsequence of s
.
Given a positive integer n
, find the pivot integer x
such that:
1
and x
inclusively equals the sum of all elements between x
and n
inclusively.