You can use Array and a more refined approach would be to create linked list. Linked List is a data structure. When you pick up an object store it in 0th index of the array and when you pick the 2nd object store it in the 1st index and so on. And when you drop the 1st index object the 2nd index object should automatically move the place of the 1st element to make a more precise inventory system. Use a for loop to check which index of the array is empty and store an object there.
Hope it helps.