LeetCode Teemo Attacking In LLP world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascending time series towards Ashe and the poisoning time duration per Teemo's... Read More

# Tag Archives: 数组

# LeetCode Insert Delete GetRandom O(1) - Duplicates allowed

LeetCode Insert Delete GetRandom O(1) - Duplicates allowed Design a data structure that supports all following operations in average O(1) time. Note: Duplicate elements are allowed. insert(val): Inserts an item val to the collection. remove(val):... Read More

# LeetCode Insert Delete GetRandom O(1)

LeetCode Insert Delete GetRandom O(1) Design a data structure that supports all following operations in average O(1) time. insert(val): Inserts an item val to the set if not already present. remove(val): Removes an item val from the set if... Read More

# LeetCode Two Sum II - Input array is sorted

LeetCode Two Sum II - Input array is sorted Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that... Read More

# LeetCode Find All Duplicates in an Array

LeetCode Find All Duplicates in an Array Given an array of integers, 1 ≤ a ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twice in this array. Could you do it without extra space and in... Read More

# LeetCode Find All Numbers Disappeared in an Array

LeetCode Find All Numbers Disappeared in an Array Given an array of integers where 1 ≤ a ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of inclusive that do not appear in this array. Could you do... Read More

# LeetCode Max Consecutive Ones

LeetCode Max Consecutive Ones Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: Output: 3 Explanation: The first two digits or the last three digits are consecutive 1s. The maximum number of... Read More