归档 2016

[LeetCode]Insert Delete GetRandom O(1) - Duplicates allowed

题目描述:

LeetCode 381. 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.

  1. insert(val): Inserts an item val to the collection.
  2. remove(val ...

继续阅读

[LeetCode]Combination Sum IV

题目描述:

LeetCode 377. Combination Sum IV

Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.

Example:

nums = [1, 2, 3]
target = 4

The possible ...

继续阅读

每月存档

去年

明年