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
fun main(args: Array<String>) { | |
groupAnagrams(arrayOf("eat", "tea", "tan", "ate", "nat", "bat")) | |
} | |
fun groupAnagrams(strs: Array<String>): List<List<String>> { | |
//Loop through array | |
val myMap = mutableMapOf<String, MutableList<String>>() | |
strs.forEach { | |
//take word and put in alphabetical order | |
val alphaOrdered = it.toCharArray().sorted().joinToString("") | |
//use alphabetized string as hash key |
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
fun main(args: Array<String>) { | |
val nums = intArrayOf(0,1,0,3,12) | |
moveZeroes(nums) | |
nums.map { | |
print("$it, ") | |
} | |
} | |
fun moveZeroes(nums: IntArray): Unit { | |
val zeroesCount = nums.count { it == 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
fun main(args: Array<String>) { | |
maxSubArray(intArrayOf(-2,1,-3,4,-1,2,1,-5,4)) | |
} | |
fun maxSubArray(nums: IntArray): Int { | |
val maxSums = mutableListOf<Int>() | |
nums.toList() | |
var i = 0 | |
while (i < nums.size) { | |
val subList = nums.toList().subList(i, nums.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
fun main(args: Array<String>) { | |
println(isHappy(1111111)) | |
} | |
fun isHappy(n: Int): Boolean { | |
val mathed = doTheMath(n) | |
println(mathed) | |
return mathed == 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
[ | |
{ | |
"action": "talk", | |
"voiceName": "Russell", | |
"text": "You have done that you should be sorry for. There is no terror, Cassius, in your threats, For I am arm'd so strong in honesty That they pass by me as the idle wind, Which I respect not. I did send to you For certain sums of gold, which you denied me: For I can raise no money by vile means: By heaven, I had rather coin my heart, And drop my blood for drachmas, than to wring From the hard hands of peasants their vile trash By any indirection: I did send To you for gold to pay my legions, Which you denied me: was that done like Cassius? Should I have answer'd Caius Cassius so? When Marcus Brutus grows so covetous, To lock such rascal counters from his friends, Be ready, gods, with all your thunderbolts; Dash him to pieces!" | |
} | |
] |
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
[ | |
{ | |
"action": "talk", | |
"text": "Thank you for calling Chris" | |
}, | |
{ | |
"action": "connect", | |
"from": "19177176397", | |
"endpoint": [ | |
{ |
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
gem install nexmo |
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
gem install sinatra | |
gem install sinatra-contrib |
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
conversation.on("member:media", (member, event) => { | |
console.log(`*** Member changed media state`, member, event) | |
}) |
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
conversation.sendText("Hello World!") | |
.then(() => console.log('text sent')) |
NewerOlder