Brandon
223
223
Rank31
31
Badges6292
6292
Score
Brandon submitted Solution 11902567 to Problem 51173. Squares inside a square! on 24 Aug 2023 |
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 received Creator badge for Problem 58827. Troubles With Spaces - Convert Some Messy Data Into A Clean Array on 7 Aug 2023 |
Brandon submitted Problem 58827. Troubles With Spaces - Convert Some Messy Data Into A Clean Array to Community on 7 Aug 2023 |
Brandon submitted Solution 11773627 to Problem 1451. Symmetry of vector on 28 Jul 2023 |
Brandon submitted Solution 11773607 to Problem 1451. Symmetry of vector on 28 Jul 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 Solution 11670558 to Problem 1394. Prime Ladders 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 submitted Solution 11646978 to Problem 2736. Pernicious Anniversary Problem on 6 Jul 2023 |
Brandon submitted Solution 11646958 to Problem 44403. Goldbach's marginal conjecture - Write integer as sum of three primes on 6 Jul 2023 |
Brandon submitted Solution 11646943 to Problem 248. Twins in a Window on 6 Jul 2023 |
Brandon submitted Solution 11646928 to Problem 3016. Twin Primes on 6 Jul 2023 |
Brandon received Community Group Solver badge for All Things Fibonacci on 6 Jul 2023 |
Brandon submitted Solution 11646528 to Problem 8057. (Linear) Recurrence Equations - Generalised Fibonacci-like sequences on 6 Jul 2023 |
Brandon received Community Group Solver badge for Basics - Fibonacci on 6 Jul 2023 |
Brandon submitted Solution 11646483 to Problem 43016. Find the next Fibonacci number on 6 Jul 2023 |
Brandon submitted Solution 11645933 to Problem 3092. Return fibonacci sequence do not use loop and condition on 6 Jul 2023 |
Brandon submitted Solution 11645583 to Problem 42340. Fibonacci Decomposition on 6 Jul 2023 |
Brandon submitted Solution 11645548 to Problem 44481. How many Fibonacci numbers? on 6 Jul 2023 |
Brandon submitted Solution 11645488 to Problem 44311. Number of Even Elements in Fibonacci Sequence on 6 Jul 2023 |
Brandon submitted Solution 11645468 to Problem 12. Fibonacci sequence on 6 Jul 2023 |
Brandon submitted Solution 11645378 to Problem 1946. Fibonacci-Sum of Squares 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 Solution 11639453 to Problem 93. Calculate the Levenshtein distance between two strings on 5 Jul 2023 |
Brandon submitted Solution 11632063 to Problem 44340. Recaman Sequence - III on 3 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 Solution 11631748 to Problem 44385. Extra safe primes on 3 Jul 2023 |
Brandon submitted Solution 11631703 to Problem 44384. Find the nearest prime number 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 Solution 11618803 to Problem 44343. Pair Primes on 29 Jun 2023 |
Brandon submitted Solution 11618338 to Problem 44343. Pair Primes 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 Solution 11618028 to Problem 44387. Birthday cake on 29 Jun 2023 |
Brandon submitted Solution 11614393 to Problem 42409. Divisible by 7 on 28 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 |
Brandon submitted Solution 11611228 to Problem 42418. Divisible by 16 on 27 Jun 2023 |
Brandon submitted Solution 11611223 to Problem 42408. Divisible by 6 on 27 Jun 2023 |
Brandon submitted Solution 11611213 to Problem 42411. Divisible by 9 on 27 Jun 2023 |
Brandon submitted Solution 11611208 to Problem 42405. Divisible by 3 on 27 Jun 2023 |
Brandon submitted Solution 11611193 to Problem 42412. Divisible by 10 on 27 Jun 2023 |
Brandon submitted Solution 11611188 to Problem 42407. Divisible by 5 on 27 Jun 2023 |
Brandon submitted Solution 11611183 to Problem 42410. Divisible by 8 on 27 Jun 2023 |