Link Details

Link 968569 thumbnail
User 321090 avatar

By Laubi
via codeblog.ch
Published: May 14 2013 / 18:50

A solution in Google's language Go to a riddle asked during job interviews at tech companies you can't use in an interview.
  • 6
  • 0
  • 401
  • 602

Comments

Add your comment
User 368023 avatar

yakkoh replied ago:

0 votes Vote down Vote up Reply

for 1000! numbers contributing to zeroes are: numbers ending with 0, 00 and 000: 111 and numbers ending with 2 multiply by numbers ending with 5: 100; total 211.

User 321090 avatar

Laubi replied ago:

1 votes Vote down Vote up Reply

I'm afraid but you're missing quite a few zeros this way! There are three correct solutions in my post.

User 1106155 avatar

vickytambule replied ago:

0 votes Vote down Vote up Reply

the variable count would return 248???

User 321090 avatar

Laubi replied ago:

0 votes Vote down Vote up Reply

In the script posted by Jay, make sure count is set to 0 before you run the code and n is equal to 1000. I get something different but you are very close ;-)

User 1106155 avatar

vickytambule replied ago:

0 votes Vote down Vote up Reply

i think it will return 249??

User 321090 avatar

Laubi replied ago:

0 votes Vote down Vote up Reply

Yes, 249 is the correct result!

User 368023 avatar

yakkoh replied ago:

0 votes Vote down Vote up Reply

The problem is slightly more complicated than expected, without of course computing the 2560+ digits of 1000!

User 321090 avatar

Laubi replied ago:

0 votes Vote down Vote up Reply

Yes, the problem is a bit tricky but I managed to figure it out and thought I'd try the brute-force way too ;-)

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (5)



Voters Against This Link (0)



    Java Performance Optimization
    Written by: Pierre-Hugues Charbonneau
    Featured Refcardz: Top Refcardz:
    1. Design Patterns
    2. OO JS
    3. Cont. Delivery
    4. Java EE7
    5. HTML5 Mobile
    1. Node.js
    2. Debugging JavaScript
    3. OO JS
    4. JSON
    5. Ajax