HHC 2021 Programming Contests - Surprise !
|
10-07-2021, 10:50 PM
(This post was last modified: 10-07-2021 10:51 PM by Craig Bladow.)
Post: #28
|
|||
|
|||
RE: HHC 2021 Programming Contests - Surprise !
Here is my second place entry in the HHC 2021 RPN contest. As submitted it was 72 bytes. I removed the STOP at the end so as presented here it is 71 bytes.
My strategy was to get something working, with some efficiency, and then reduce the program size. My approach compared each digit with its match until failure, so it would not spend time reversing the entire number for every candidate. Also only the first odd number of digits, greater than N/2 (N is the number of digits), would be compared. Very late Saturday I had achieved the first two goals but ran out of time to try any new approaches. Code:
But did I develop the faster solution? I keyed in David Hayden's excellent first place solution, which is a very elegant and compact program and ran Gene's 15151 test number as input. The above routine took 16 seconds to find the next palindrome and David's winning solution took 24 seconds, on the same DM41X, in fast mode, on battery power. So a small consolation! Try CC41! |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)