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
{ | |
"Become conversational": "", | |
"talk like a native in any language": "", | |
"Real conversations": "", | |
"Grammar explanations": "", | |
"Translation breakdowns": "", | |
"change your foreign language": "", | |
"help": "", | |
"Login": "", | |
"Register": "", |
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
const capitalAfterVowel = (phrase) => { | |
if (phrase.length === 0) return; | |
let indices = []; | |
for (let i = 1; i < phrase.length; i++) { | |
if (/^[aeiou]$/.test(phrase[i - 1]) && !/^[aeiou]$/.test(phrase[i])) { | |
indices.push(i); | |
} | |
} | |
let copy = []; | |
phrase.split("").map((elem, index) => { |
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
const numberOfOnes = (num) => { | |
let sum = 0; | |
for(let i = 0; i <= num; i++){ | |
sum += i.toString().split("").filter(number => number === '1').length; | |
} | |
return sum; | |
} | |
console.log(numberOfOnes(14)); //7 |
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
package com.company; | |
import java.util.*; | |
public class Trie { | |
public static void main(String[] args) { | |
// String s = "tttt"; | |
Trie t = new Trie(); | |
// t.insert(s); | |
// t.insert("ttt"); | |
// System.out.println(t.startsWith("tt")); |
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 Trie { | |
public static void main(String[] args) { | |
String s = "tttt"; | |
Trie t = new Trie(); | |
t.insert(s); | |
t.insert("ttt"); | |
System.out.println(t.startsWith("tt")); | |
} |
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
//Week of May 3rd 2020 | |
//Given an array of words, return the words that can be typed using letters of only one row on a keyboard. | |
//QWERTY keyboard only | |
let rowOne = ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'] | |
let rowTwo = ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l'] | |
let rowThree = ['z', 'x', 'c', 'v', 'b', 'n', 'm'] | |
//Looks at eache character of each word and dtermines if they are on the same row (in the same array as the first letter ) | |
function oneRow (arr) { | |
words = [] | |
for (let i = 0; i < arr.length; 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
/** | |
* Definition for a binary tree node. | |
* public class TreeNode { | |
* int val; | |
* TreeNode left; | |
* TreeNode right; | |
* TreeNode(int x) { val = x; } | |
* } | |
*/ | |
class BTLOT { |
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.io.*; | |
import java.nio.ByteBuffer; | |
public class BinaryParser { | |
/** | |
* byte array Byte buffer | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
try { |
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 class Growth{ | |
/** | |
n!,2n,2n^2, 5nlogn,20n,10n | |
*/ | |
public static void main(String [] args){ | |
long fact, twon, twon2, fivenlogn, twentyn, tenn; | |
for(long i = 0; i < 20; i++){ | |
fact = fact(i); | |
twon = (long)Math.pow(2, i); | |
twon2 = 2 * (long)Math.pow(i, 2); |
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
=begin | |
Converts hex codes to rgb | |
https://www.mathsisfun.com/hexadecimals.html | |
supports hashtag and non hashtag | |
@param s string to be converted to RGB | |
@return RGB representation of a string | |
=end | |
def hex_to_rgb(s) | |
if s[0] == "#" #removes '#' from evalutation | |
s = s[1..s.length] |
NewerOlder