Skip to content

Files

Latest commit

Jul 15, 2019
ee29737 · Jul 15, 2019

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jul 15, 2019
Jul 15, 2019

You have a large array with most of the elements as zero.

Use a more space-efficient data structure, SparseArray, that implements the same interface:

  • init(arr, size): initialize with the original large array and size.
  • set(i, val): updates index at i with val.
  • get(i): gets the value at index i.