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 isPalindrome(number): | |
string = str(number) | |
list = [] | |
revList = [] | |
i = 0; | |
while i<len(string): | |
list.append(string[i]) | |
i += 1 |
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
public static void problem1(){ | |
Set<Integer> multiples = new HashSet<Integer>(); | |
for(int i=1; i<1000; i++){ | |
if(i%3==0 || i%5==0){ | |
multiples.add(i); | |
} | |
} | |
Integer[] numbers = multiples.toArray(new Integer[multiples.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
public static void problem2(){ | |
int a = 1; | |
int b = 2; | |
int c = 0; | |
List<Integer> even = new ArrayList<Integer>(); | |
do{ | |
c = a + b; | |
if(b%2==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
def problem5(): | |
i=20 | |
while(True): | |
print(i) | |
if i%20==0 and i%19==0 and i%18==0 and i%17==0 and i%16==0 and i%15==0 and i%14==0 and i%13==0 and i%12==0 and i%11==0: | |
print(i) | |
break | |
i+= 20 |
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 sumOfSqure(number): | |
total = 0 | |
for i in range(1, number + 1): | |
total += i*i | |
return total | |
def squareOfSum(number): | |
total = 0 | |
for i in range(1, number + 1): | |
total += i |
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 problem7(): | |
i=2 | |
count = 0 | |
while(True): | |
if(isPrime(i)): | |
count += 1 | |
if(count==10001): | |
print(i) | |
break | |
i += 1 |
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
// Setup | |
function phoneticLookup(val) { | |
var result = ""; | |
let lookup = { | |
alpha: 'Adams', | |
bravo: 'Boston', | |
charlie: 'Chicago', | |
delta: 'Denver', | |
echo: 'Easy', |
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
// Setup | |
var myObj = { | |
gift: "pony", | |
pet: "kitten", | |
bed: "sleigh" | |
}; | |
function checkObj(checkProp) { | |
//Check if the Object has that property, not check the value. |
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
//Setup | |
var contacts = [ | |
{ | |
"firstName": "Akira", | |
"lastName": "Laine", | |
"number": "0543236543", | |
"likes": ["Pizza", "Coding", "Brownie Points"] | |
}, | |
{ | |
"firstName": "Harry", |
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
// Question 1 | |
var i=0; | |
var mulArr = []; | |
while(i<=100){ | |
if(i%3 == 0 || i%5 == 0){ | |
mulArr.push(i) | |
} | |
i++; | |
} |
OlderNewer