Hisham_hates_graphs's blog

By Hisham_hates_graphs, history, 4 years ago, In English

there is an interview problem i want you to help me solve if you can please suppose we have many stones each stone have a uniqe number

we arrange this stones to make shapes

example

we make a shape with 3 stones {4,8,3} and make shape with 4 stones {5,3,6,7}

note that we can use the same type of stone more than once (so you can say that we have infinite number of each type)

i want to set this data in array of integer so we can read from the array every set of stones that make a shape

no hash maps no array of strings no array of pairs just array of integers

and dont suggest to put 8 in index 4 and put 3 in index 8 and put 4 in index 3 because number 3 here will belong to just this shape and dont belong to the other one

is there anyway?

| Write comment?