Brandon - MATLAB Cody - MATLAB Central

Brandon

223
Rank
31
Badges
6292
Score
1 – 50 of 706

Brandon submitted a Comment to Solution 11818872

Ah, now this is starting to look like the code I implemented (i.e. FAST). As for the data I'm actually running, speed isn't an issue on a single run; the problem is that I have to GET the data before I can do anything. So every time I need to debug, I have to wait for str2num and whatever else is running on top of that. The most straightforward way to process the data takes SECONDS (Your original answer takes two seconds on my dataset, and my original solution took four, which was almost identical but replace() used cellfun), so the only options were to either keep a pre-processed copy of the data for debugging, or write something faster. Of course, having a variety of data is preferable for debugging, so I chose the faster code option. And, of course, as soon as I wrote it, data of a different format became a possibility. I resorted to the slower code as a fallback for other data types (the decimal is shifted and larger values are possible). Again, data processing was taking too long. I thought about Matlab answers, but realized this would make for an interesting Cody problem, especially since I loathe the simple regexp solutions (or double(figure) :P), and things like "str2double(replace(x, ' ', ''));" look nice but are super slow. I've since updated my fallback code to code that is 0.5s. With just a bit of data processing, I've gotten a str2num solution to work much faster than originally, although it no longer passes the final test case like it would have before. But nice work. I do love some janky-looking fast code!

on 8 Aug 2023

Brandon submitted a Comment to Solution 11816582

For a bit of backstory, this problem is based off a data structure identical to what I'm using for my job. And I *swear* replace didn't work unless I used cellfun, which made solutions like this time out on Cody. And I find it funny that str2double works on '+++++++' but str2num doesn't, even though str2num works on "plus space number." Anyway, I was being kind with the 3 million numbers to give some leeway to slower solutions. I have stopped being so kind. :P

on 8 Aug 2023

Brandon submitted a Comment to Solution 11642858

SMALLER than regexp?! I can think of a ton of problems this hack would work with. You may have unleashed a great evil upon the Cody with this answer... I guess I was technically wrong too, as I'd seen both polyval and figure(YOU) used to solve problems before. So you solved it given (then) current technology. VERY nicely done!

on 28 Jul 2023

Brandon submitted a Comment to Solution 608767

Takes too long to run five digit primes

on 12 Jul 2023

Brandon submitted a Comment to Solution 10630720

I thought of doing something similar with random, but this code fails on run-time for five-digit primes. It's super slow.

on 12 Jul 2023

Brandon submitted a Comment to Solution 11496944

This cheater really thought 777 was prime lol If only there was a program they could have used to check...

on 12 Jul 2023

Brandon received Community Group Solver badge for The Prime Directive

on 12 Jul 2023

Brandon submitted a Comment to Problem 1394. Prime Ladders

"I will only check that the conditions of a prime ladder are met." Nicely done

on 6 Jul 2023

Brandon received Community Group Solver badge for All Things Fibonacci

on 6 Jul 2023

Brandon received Community Group Solver badge for Basics - Fibonacci

on 6 Jul 2023

Brandon submitted a Comment to Solution 11232859

But seriously, double(figure) is the dirtiest hack I've seen in a while. I like it.

on 5 Jul 2023

Brandon submitted a Comment to Solution 11639453

inb4 someone finally does a regex solution...

on 5 Jul 2023

Brandon submitted a Comment to Solution 11232859

Your magics are foreign to me, and beyond my comprehension. However, my powers have grown since I was but a wee lad. Behold my current power level! 11639453

on 5 Jul 2023

Brandon submitted a Comment to Problem 44815. Word Distance - Sum

Why would you create a problem with multiple kinds of inputs? This is just stupid.

on 3 Jul 2023

Brandon submitted a Comment to Problem 44343. Pair Primes

Why ban elseif for this problem? I need a test for x==2, x==3, x==4, and x==5. But if one test is true, I do not want the rest to execute. The best way to do this is with elseif. So I hacked the answer to spite it all.

on 29 Jun 2023

Brandon submitted a Comment to Problem 44387. Birthday cake

Too many math answers on this one. Let's see some simulations, people!

on 29 Jun 2023

Brandon submitted a Comment to Problem 42409. Divisible by 7

This one is dumb, as you need to use all the digits in the number. You might as well just use normal long division. Plus, I have to implement modular arithmetic, which uses mod, which is banned in this problem.

on 28 Jun 2023

1 – 50 of 706
Go to top of page