Skip to content

Instantly share code, notes, and snippets.

class RegisterForm(Form):
name = TextField('Username', [Required()])
email = TextField('Email address', [Required(), Email()])
password = PasswordField('Password', [Required()])
confirm = PasswordField('Repeat Password', [
Required(),
EqualTo('password', message='Passwords must match')
])
accept_tos = BooleanField('I accept the TOS', [Required()])
recaptcha = RecaptchaField()
import java.io.*;
import java.util.*;
class permutation {
public static void main(String[] args) {
String str1 = "abc";
String str2 = "cba";
if(permutation(str1, str2))
System.out.println("They are each other's permutation");
else
@larry-liu
larry-liu / reverse.c
Created June 18, 2014 01:46
CC1.2(Reverse)
#include <stdio.h>
#include <stdlib.h>
void reverse(char* str);
int main(){
char* str = malloc(256);
strcpy(str, "this is for test");
printf("%s\n",str);
reverse(str);
import java.util.HashSet;
import java.util.Set;
public class UniqueChar {
public static boolean check(String s) {
Set<Character> hashset = new HashSet<Character>();
for (int i = 0; i < s.length(); i++) {
if (hashset.contains(s.charAt(i)))
return false;
else
hashset.add(s.charAt(i));