This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
#define MAX 100 | |
static int memo[MAX+1]; | |
static int partitions(int n) { | |
int p = memo[n]; | |
if (p != 0) return p; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Results in comments are from Ruby 3.2.2, libxml-ruby 4.1.1 on macOS | |
require 'libxml-ruby' | |
# new() is undefined for Writer | |
# https://github.com/xml4r/libxml-ruby/blob/master/ext/libxml/ruby_xml_writer.c#L1134 | |
# LibXML::XML::Writer.new() # crash: undefined method `new' for LibXML::XML::Writer:Class (NoMethodError) | |
LibXML::XML::Writer.io(nil) # warning: undefining the allocator of T_DATA class LibXML::XML::Writer | |
# new() is neither undefined nor redefined for Reader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/questions/53585022/three-colors-triangles/53588144#53588144 | |
// https://www.codewars.com/kata/insane-coloured-triangles/train/c | |
#define _GNU_SOURCE | |
#include <stdlib.h> | |
#include <string.h> | |
char triangle(const char *s) | |
{ | |
char* row = strdup(s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.util.stream.*; | |
import static java.util.stream.Collectors.*; | |
import java.io.*; | |
import java.nio.file.*; | |
public class ProcFunc { | |
public static <T> Iterator<T> limit(Iterator<? extends T> it, int max) { | |
return new Iterator<T>() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.util.stream.*; | |
import static java.util.stream.Collectors.*; | |
import java.util.function.*; | |
class Value { | |
private final String key; | |
public Value(String key) { |