Noufaln26's blog

By Noufaln26, history, 11 years ago, In English

suppose a set [1,5,7,10] we want to make any numbers using these element with these elements in the test,we want to make mnumbers with minimum number of operations for eg: 98=9*10+1*7+1*1 so total 10 opearation. [python,java,c,cpp]

  • Vote: I like it
  • -3
  • Vote: I do not like it

| Write comment?
»
11 years ago, hide # |
← Rev. 3  
Vote: I like it 0 Vote: I do not like it

I think you can do a BFS. Each number from set is a vertex, and for each number/vertex we can find out others ones with minimum operation, each number from set is an adjacent vertex of each vertex.

»
11 years ago, hide # |
← Rev. 4  
Vote: I like it -8 Vote: I do not like it

Nice problem :)