Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
#120 times out
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jannik Jochem  
View profile   Translate to Translated (View Original)
 More options Jul 10 2012, 10:56 am
From: Jannik Jochem <jannik.joc...@googlemail.com>
Date: Tue, 10 Jul 2012 07:56:52 -0700 (PDT)
Local: Tues, Jul 10 2012 10:56 am
Subject: #120 times out

Hello,

I've been trying to solve Problem 120 <http://www.4clojure.com/problem/120>.
In a REPL, the following solution works:

(fn [xs]
  (count
    (filter
      (fn [x]
        (< x
          (reduce + (map
            (comp #(* % %) #(Integer/parseInt (str %)))
          (seq (str x))))))
      xs)))

When I try to submit this solution, I always hit a timeout. Is it possible
that the last test case is a little over the top?

Cheers,

Jannik


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hak  
View profile  
 More options Jul 10 2012, 2:23 pm
From: hak <hkue...@googlemail.com>
Date: Tue, 10 Jul 2012 11:23:40 -0700 (PDT)
Local: Tues, Jul 10 2012 2:23 pm
Subject: Re: #120 times out

> i checked my old solution for the problem, it is about as fast as yours
> and did not timeout. So there seems to be a problem with 4clojure.
> Cheers,

    hak


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ctzsm  
View profile  
 More options Sep 27 2012, 12:07 am
From: ctzsm <ehkremi...@gmail.com>
Date: Wed, 26 Sep 2012 21:07:46 -0700 (PDT)
Local: Thurs, Sep 27 2012 12:07 am
Subject: Re: #120 times out

It seems that the Integer/parseInt is very slow in the sandbox of 4clojure.

so you can replace it with something else.

I tried your solution and replaced the Integer/parseInt, it works fine.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »