Comment by qwr on Solve a squared cryptarithm
Is there any solution better than brute-force?
View ArticleComment by qwr on Find the best staircase to maximize the sum
I suspect a DP grid approach using prefix sums will work.
View ArticleComment by qwr on Find the best staircase to maximize the sum
What is the resulting time complexity? The asymptotic complexity for computing all paths is exponential.
View ArticleComment by qwr on Output intervals for the optimal subarrays
Shouldn't the first example have for k=2 the subarray containing 1?
View ArticleComment by qwr on Find the best staircase to maximize the sum
I haven't worked out exactly how k works. If I have the energy I'll put a simple implementation.
View ArticleComment by qwr on What and where is the max?
@Giuseppe I see; the behavior is different than which.max.
View ArticleComment by qwr on Number of cigarettes that can be made from a given number...
code means heart divides
View ArticleComment by qwr on What and where is the max?
@ovs I knew there was a len trick but I didn't think of transpose
View ArticleComment by qwr on Is this number tetrahedral?
This can easily be a C function that returns through arguments.
View ArticleComment by qwr on Is it a valid ARM immediate value?
I'm waiting on an answer written in ARM
View ArticleAnswer by qwr for Upgoat or Downgoat?
Python 3, OpenCV with Hough Transform, 100%My original idea was to detect the vertical lines of the goat's legs and determine its vertical position relative to the body and horizon.As it turns out, in...
View ArticleAnswer by qwr for Tips for Golfing in Standard ML
Pattern matching in functionsConcise way to extract the values and write cases for recursive functions. Case statements are probably too long.Extracting values:fn(x,y)=>x+y (* lambda fn *)fun f x...
View ArticleAnswer by qwr for Tips for Golfing in Standard ML
Use wildcard matching instead of explicit matchingThis broadly applies to any pattern matching construct with a fallthrough or wildcard: in some situations you can use the wildcard to match a pattern...
View ArticleBest Rolling Ao5
In speedcubing, an Ao5 (Average of 5) is computed for a set of five times by removing the fastest and slowest times, and then computing the mean of the remaining three times.A "rolling ao5" is computed...
View ArticleAnswer by qwr for Convert Descriptive Notation to Algebraic Notation
Python 3.10, 82 byteslambda b,s:C[C.find(s[:-1])-1]+str(abs(9*b-int(s[-1])))C="dQeKaQRbQNcQBfKBgKNhKR"Attempt This Online!Testing out dictionary interleaving idea which is a little shorter than...
View ArticleConvert Descriptive Notation to Algebraic Notation
IntroductionMany old chess books use descriptive notation to notate squares on a chessboard, naming the file (column) of the square based on the starting piece positions of White or Black, depending on...
View ArticleSmall Ramsey Numbers
Background: the Ramsey number \$R(r,s)\$ gives the minimum number of vertices \$v\$ in the complete graph \$K_v\$ such that a red/blue edge coloring of \$K_v\$ has at least one red \$K_r\$ or one blue...
View ArticleAnswer by qwr for Print last inputted byte
Standard ML, 8 bytesThere are two common ways of string processing: char lists and strings. In both cases, the underlying char is an 8 bit value using "extended ASCII".For char lists:hd o revI'm not...
View ArticleSuper speedy totient function
The goal is simple: calculate the totient function for as many numbers as you can in 10 seconds and sum the numbers.You must print your result at the end and you must actually calculate it. No...
View Article
More Pages to Explore .....