A funny program I just write,Check!
posted 14 years ago
here is the problem,it might be some interview stuff from one company,never mind...
Give you 10 number [0,1,2,3,4,5,6,7,8,9],and we need you return me another 10 number to satisfy:
the number in the second line is the number of times in which the first line number show up in the second line..
it's hard to understand,I'll give an example:
for:[0,1,2,3,4,5,6,7,8,9]
we have: [6,2,1,0,0,0,1,0,0,0]
it means:the number '0' show 6 times in the second line,and the number '1' show 2 times in the second line......
I just solve it with Java.
you guys can try it. I will put my code on later if you need it..
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
here is the problem,it might be some interview stuff from one company,never mind... Give you 10 number [0,1,2,3,4,5,6,7,8,9],and we need you return me another 10 number to satisfy:
the number in the second line is the number of times in which the first line number show up in the second line..
it's hard to understand,I'll give an example:
for:[0,1,2,3,4,5,6,7,8,9]
we have: [6,2,1,0,0,0,1,0,0,0]
it means:the number '0' show 6 times in the second line,and the number '1' show 2 times in the second line......
I just solve it with Java.
you guys can try it. I will put my code on later if you need it..
Enjoy a cup of Java.
posted 14 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
this sounds like one of the very few things I thought were diversions when I was on the diversions forum. I shall move it there.
posted 14 years ago
you are the boss,man.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Campbell Ritchie wrote:this sounds like one of the very few things I thought were diversions when I was on the diversions forum. I shall move it there.
you are the boss,man.
Enjoy a cup of Java.
posted 14 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
so if input is
[11,44,99,11,22,55,66,77,10,99] output should be-
[1,5,2,0,2,2,2,2,0,4]? frequency of numbers from 0 to 9?
[11,44,99,11,22,55,66,77,10,99] output should be-
[1,5,2,0,2,2,2,2,0,4]? frequency of numbers from 0 to 9?
MH
posted 14 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Nope. If you look at the sequence [6,2,1,0,0,0,1,0,0,0] you will see that there are 6 0's, 2 1's, 1 2's, 0 3's, and so on. The business about [0,1,2,3,4,5,6,7,8,9] is just confusing and misleading, so ignore that.
posted 14 years ago
the input is constant[1,2,3,4,5,6,7,8,9]. if you choose other numbers like[11,44,99,11,22,55,66,77,10,99],
the 1 should be the times that 11 shows up in your answer,just as [1,5,2,0,2,2,2,2,0,4]. it's obvious that the answer
is wrong,because 11 show 0 times in the second line.
it's not about the sequence,it's just the number
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Arjun Shastry wrote:so if input is
[11,44,99,11,22,55,66,77,10,99] output should be-
[1,5,2,0,2,2,2,2,0,4]? frequency of numbers from 0 to 9?
the input is constant[1,2,3,4,5,6,7,8,9]. if you choose other numbers like[11,44,99,11,22,55,66,77,10,99],
the 1 should be the times that 11 shows up in your answer,just as [1,5,2,0,2,2,2,2,0,4]. it's obvious that the answer
is wrong,because 11 show 0 times in the second line.
it's not about the sequence,it's just the number
Enjoy a cup of Java.
posted 14 years ago
[0,1,2,3,4,5,6,7,8,9]is the first line,
and the answer [6,2,1,0,0,0,1,0,0,0] is the second line.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Paul Clapham wrote:Nope. If you look at the sequence [6,2,1,0,0,0,1,0,0,0] you will see that there are 6 0's, 2 1's, 1 2's, 0 3's, and so on. The business about [0,1,2,3,4,5,6,7,8,9] is just confusing and misleading, so ignore that.
[0,1,2,3,4,5,6,7,8,9]is the first line,
and the answer [6,2,1,0,0,0,1,0,0,0] is the second line.
Enjoy a cup of Java.
posted 14 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
it's like your answer just determines your answer...
you can show this character out in your code..
you can show this character out in your code..
Enjoy a cup of Java.
posted 14 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Is [6,2,1,0,0,0,1,0,0,0] the only answer?
posted 14 years ago
for now,that's true..
but if you change the input,there could be some other conditions..
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Ryan McGuire wrote:Is [6,2,1,0,0,0,1,0,0,0] the only answer?
for now,that's true..
but if you change the input,there could be some other conditions..
Enjoy a cup of Java.
| Those cherries would go best on cherry cheesecake. Don't put those cherries on this tiny ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |








