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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<style> | |
#table_score { | |
border-collapse: collapse; | |
padding: 12px; | |
} |
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 <stdlib.h> | |
#include <string.h> | |
#include <malloc.h> | |
#include <stdbool.h> | |
bool check(int max, char *p) | |
{ | |
/* simulate the push/pop of stacks */ | |
bool *stack = (bool *)malloc((max+1) * sizeof(*stack)); |
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
class Solution: | |
def subsets(self, S): | |
self.ht = {} | |
ret = [[]] | |
s_sorted = sorted(S) | |
for set_length in range(1, len(S)+1): | |
ret += self.subset(s_sorted, 0, set_length) | |
return ret | |
def subset(self, S, index, l): |
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 <iostream> | |
using namespace std; | |
int partition(int array[], int lo, int hi) | |
{ | |
// pivot=A[hi]; A[i] < pivot; A[j] >= pivot | |
int i = lo-1; | |
int j = lo; | |
for (j = 0; j < hi; ++j) { |
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
#!/bin/sh | |
# Slackware build script for <appname> | |
# Copyright <year> <you> <where you live> | |
# All rights reserved. | |
# | |
# Redistribution and use of this script, with or without modification, is | |
# permitted provided that the following conditions are met: | |
# |
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 <stdbool.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define MAX_ELEMENT 64 | |
int num_of_sticks; | |
bool used[MAX_ELEMENT]; | |
int sticks[MAX_ELEMENT]; | |
int sum; |
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<sys/types.h> | |
#include<memory.h> | |
int findmax(int a[]) | |
{ | |
int i; | |
for(i=1; i<1000; i++) | |
{ | |
if(a[i]>a[0]) |
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 <malloc.h> | |
#include <string.h> | |
int num_of_cycle(int n) | |
{ | |
int ret; /* return value */ | |
int *rem_seen = (int *)malloc(n * sizeof(*rem_seen)); | |
memset(rem_seen, 0, n*sizeof(*rem_seen)); |
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
(define (s-sieve limit) | |
(define sieve-size (add1 (integer-sqrt limit))) | |
(define sieve (make-vector sieve-size #t)) | |
; sieve of eratosthenes | |
(for* ([i (in-range 2 sieve-size)] | |
#:when (vector-ref sieve i) | |
[j (in-range (* i i) sieve-size i)]) | |
(vector-set! sieve j #f)) | |
; collect sieve | |
(define primes (for/list ([n (in-range 2 sieve-size)] |
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> | |
/* Function to swap values at two pointers */ | |
void swap (char *x, char *y) | |
{ | |
char temp; | |
temp = *x; | |
*x = *y; | |
*y = temp; | |
} |