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
<?php | |
class StringBalance { | |
private $startBrace = "("; | |
private $endBrace = ")"; | |
public $debug = false; | |
private $startBraceFound; | |
private $endBraceFound; |
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
<?php | |
function printPalindromes($str) | |
{ | |
#$str = strtolower(preg_replace("'\s+'", '', $str)); | |
$str = strtolower(preg_replace("([^A-Za-z0-9])", "", $str)); | |
$length = strlen($str); | |
$reverse = strrev($str); | |
$matches = array(); | |
$palindrom = $str; |
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
<?php | |
function printPalindromes($str) | |
{ | |
#$str = strtolower(preg_replace("'\s+'", '', $str)); | |
#$str = strtolower(preg_replace("([^A-Za-z0-9])", "", $str)); | |
$palindrom = $str; | |
$str1 = strtolower($str); | |
$matches = array(); | |
$str = $str1; |
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
<?php | |
function getMirrorChar() | |
{ | |
$data = array( | |
'A' => 'A', | |
'E' => '3', | |
'H' => 'H', | |
'I' => 'I', | |
'J' => '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
def max_devide(number, factor): | |
while(number % factor == 0): | |
number = number / factor | |
return number | |
def is_ugly(number): | |
number = max_devide(number, 2) | |
number = max_devide(number, 3) | |
number = max_devide(number, 5) |
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
def max_devide(number, factor): | |
while(number % factor == 0): | |
number = number / factor | |
return number | |
def is_ugly(number): | |
number = max_devide(number, 2) | |
number = max_devide(number, 3) | |
number = max_devide(number, 5) |
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
<?php | |
function bcfact($n){ | |
$factorial=$n; | |
while (--$n > 1) { | |
$factorial = bcmul($factorial,$n); | |
} | |
return $factorial; | |
} | |
function getFileContent() |
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
# Require python 2.6 | |
import math | |
f = open('input.txt') | |
output = '' | |
for line in f: | |
value = math.factorial(int(line)) | |
output += line.strip() + " -> " + str(value).replace("0", "")[-1]+"\n" | |
writeFile = open('output.txt', 'w+') |
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
<?php | |
global $triangularNumberOffset, $divisors; | |
$triangularNumberOffset = 1; | |
$triangularNumber = 0; | |
function nextTriangularNumberOffset() | |
{ | |
global $triangularNumberOffset; | |
return $triangularNumberOffset++; |
OlderNewer