(defn cloud
[input]
(let [jump-small 1 jump-big 2]
(trampoline
(fn jump [idx cnt]
(let [idx' (+ idx jump-big)]
(if-let [?zero-or-one (get input idx')]
#(if (zero? ?zero-or-one) ;big or small jump?
(jump idx' (inc cnt)) ;big!
(let [idx'' (+ idx jump-small)] ;else, small
(jump idx'' (inc cnt))))
cnt))) ;else, we are done, return jump count
0 0)))
@ps there’s too much collection op stuff going on in your solution for what’s ultimately an index increment problem.
Rant: doing this kind of stuff reminds me how goofy those kind of problems are; They rarely look like what you deal with on a daily basis. P.S. I feel like there’s a higher level solution that’s shorter for the ‘cloud’ problem but I can’t think of it atm.
@raspasov would you please share the optimized code, the non-optimized code and the challenge?
@raspasov what kind of work do you do? Freelancer or for a company? @seancorfield is your company hiring?
@seancorfield can you help me get a job in your company or another company?
We are not hiring, sorry. The best thing to do is keep an eye on #jobs and #remote-jobs here and see if folks are hiring into positions where they are open to taking on “non-Clojure” developers and training them. But bear in mind the competition is likely to be stiff because a lot of people want to program in Clojure for a living — far more than there are open positions.
(one of the benefits of Clojure for companies is also somewhat of a downside for candidates: you can get a lot done with very few engineers — and Clojure developers tend to be happier than non-Clojure developers so they tend to stay in roles, which means there’s less hiring going on)
@seancorfield I’ve heard conflicting evidence about that actually. I’ve heard all three: “companies: hard to find Clojure developers” “companies: easy to find Clojure developers” “developers: hard to find Clojure jobs”
@ps sorry, I don’t have any leads at the moment. I am building a React Native app at the moment in Clojure(Script).
@raspasov I launched one on App Store: https://apps.apple.com/us/app/humboi/id1561534546 in a 1.001 person start-up.
@raspasov I’d modify those first two a bit: “companies: hard to find intermediate/senior Clojure developers” (because Clojure devs tend to stay in jobs) and “companies: easy to find folks who want to be Clojure developers” — we should probably take this part of the discussion to #jobs-discuss if we want to drill down further.
https://prit.substack.com/p/hackerrank-4 https://prit.substack.com/p/hackerrank-5
Raspasov, I scorned at Hackerrank until I failed two job interviews that did their technical interview through Hackerrank.
Understood.
For #4, I would expect something like:
(defn repeated-string [s n]
(transduce
(comp
(mapcat identity)
(take n)
(filter #(= % \a))
(map (constantly 1)))
+
0
(repeat s)))
I wouldn’t work for a company that used one of these “code golf” puzzle challenge sites as a gate for hiring — they’re a terrible way to figure out whether a candidate is good to hire! 🤯