This file contains hidden or 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 skipMultiples | |
| i = 0 | |
| range = (2...50).to_a | |
| while i < range.length | |
| if range[i] % 7 != 0 | |
| puts range[i] | |
| else | |
| range[i] = "Love conquers all!" | |
| puts range[i] |
This file contains hidden or 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 common(str) | |
| most = nil | |
| mcount = nil | |
| idx1 = 0 | |
| while idx1 < str.length | |
| char = str[idx1] | |
| count = 0 | |
| idx2 = 0 |
This file contains hidden or 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 cap(str) | |
| words = str.split(" ") | |
| idx = 0 | |
| while idx < words.length | |
| word = words[idx] | |
| word[0] = word[0].upcase # change the word within array | |
| idx += 1 |
This file contains hidden or 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 rev(str) | |
| a = 0 | |
| reverse = "" | |
| while a < str.length | |
| reverse = str[a] + reverse | |
| a += 1 |
This file contains hidden or 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 threesum | |
| end |
This file contains hidden or 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 twosum nums | |
| idx = 0 | |
| idx2 = idx + 1 | |
| while idx < nums.length | |
| n = nums[idx] | |
| i = nums[idx2] | |
| sum = n + i | |
| if sum == 0 |
This file contains hidden or 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 sqlite3 | |
| ERROR: Could not find a valid gem 'sqlite3' (>=0), here is why: | |
| Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/specs.4.8.gz) |
NewerOlder