Quantcast
Channel: User qwr - Code Golf Stack Exchange
Browsing all 50 articles
Browse latest View live

Comment by qwr on Doubleouble Talkalk

Is it possible in linear time?

View Article



Comment by qwr on Solve a squared cryptarithm

Is there any solution better than brute-force?

View Article

Comment by qwr on Find the best staircase to maximize the sum

I suspect a DP grid approach using prefix sums will work.

View Article

Comment 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 Article

Comment by qwr on Output intervals for the optimal subarrays

Shouldn't the first example have for k=2 the subarray containing 1?

View Article


Comment 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 Article

Comment by qwr on What and where is the max?

@Giuseppe I see; the behavior is different than which.max.

View Article

Comment by qwr on Number of cigarettes that can be made from a given number...

code means heart divides

View Article


Comment 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 Article


Comment by qwr on Is this number tetrahedral?

This can easily be a C function that returns through arguments.

View Article

Comment by qwr on Is it a valid ARM immediate value?

I'm waiting on an answer written in ARM

View Article

Image may be NSFW.
Clik here to view.

Answer 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 Article

Answer 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 Article


Answer 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 Article

Best 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 Article


Answer 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 Article

Image may be NSFW.
Clik here to view.

Convert 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 Article


Small 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 Article

Answer 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 Article

Super 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
Browsing all 50 articles
Browse latest View live




Latest Images