题目描述:
LeetCode 445. Add Two Numbers II
You are given two linked lists representing two non-negative numbers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as ...
LeetCode 445. Add Two Numbers II
You are given two linked lists representing two non-negative numbers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as ...
获取LinkedHashMap中的头部元素(最早添加的元素):
时间复杂度O(1)
public <K, V> Entry<K, V> getHead(LinkedHashMap<K, V> map) {
return map.entrySet().iterator().next();
}
获取LinkedHashMap中的末尾元素(最近添加的元素):
时间复杂度O(n)
public <K, V> Entry<K, V> getTail(LinkedHashMap<K, V> map) {
Iterator<Entry<K, V>> iterator = map.entrySet().iterator();
Entry<K, V> tail ...
LeetCode 442. Find All Duplicates in an Array
Given an array of integers, 1 <= a[i] <= n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twice in ...
Smarking Algorithm Contest是LeetCode举办的第九场正式周赛,共4道题目,比赛时长2.5小时。
比赛链接:https://leetcode.com/contest/smarking-algorithm-contest/
题解列表:
LeetCode 438. Find All Anagrams in a String
LeetCode 440. K-th Smallest in Lexicographical Order
Given integers n
and k
, find the lexicographically k-th smallest integer in the range from 1
to n
.
Note: 1 ≤ k ≤ n ≤ 109.
Example:
Input: n: 13 k ...