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
QUESTIONS | |
What is MongoDB? | |
MongoDB is a NoSQL database | |
Why do we need a Database? | |
To store data, which will allow us to access and manipulate it. | |
What format does MongoDB use to store data? | |
Binary JSON - similar to JSON but with other data types including ObjectId and Date |
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
var steps = 1 | |
function findProduct(array) { | |
var product = array.reduce(function(prev, curr) { | |
return prev * curr; | |
}, 1); | |
if (product < 10) { | |
console.log(steps); | |
return steps; | |
} | |
else { |
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
var steps = 1 | |
function findProduct(array) { | |
var product = array.reduce(function(prev, curr) { | |
return prev * curr; | |
}, 1); | |
if (product < 10) { | |
console.log(product); | |
console.log(steps); | |
return steps; | |
} |
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
var tripleDouble = function(first, second){ | |
var firstArray = first.toString().split(""); | |
var secondArray = second.toString().split(""); | |
for (var i = 0; i < firstArray.length - 2; i++) { | |
if (firstArray[i] == firstArray[i + 1] && firstArray[i] == firstArray[i + 2]) { | |
for (var j = 0; j < secondArray.length - 1; j++) { | |
if (secondArray[j] == secondArray[j + 1]) { | |
return 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
Given 3 branch master, feature1, and feature2. If you made a pull request on feature1 and feature2 on github and merged feature1. Then when you try to merge feature2 you realize that there are conflicts. What are the step you have to do so that you can merge feature2 on github? | |
1. Rebase the master of feature 2 branch: | |
In local of feature2: | |
gco master (so you are on master branch) | |
git pull --rebase origin master (to get all the changes from feature1) | |
gco feature2 (to go to feature2 branch) | |
git rebase master (to rebase feature2 branch with local master) | |
It will tell you that you have conflicts. | |
git status (to see which file(s) have the conflicts) | |
go to the file(s) that have the conflicts, decide which of the conflicted lines you want to keep |
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 solution(x, a) | |
bridgeArray = [] | |
timeArray = [] | |
a.each do |elem| | |
if elem <= x | |
bridgeArray << elem unless bridgeArray.include?elem | |
timeArray << a.index(elem) unless timeArray.include?a.index(elem) | |
end | |
end | |
if bridgeArray.length == x |
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
# I have written to_arabic and to_roman methods, which work (except for cases such as 4 and 9) | |
# I am in the middle of writing a method to go through an array of roman / arabic numberals and applying the to_arabic or to_roman methods to them. | |
def transform(array) | |
array.each do |elem| | |
elem.to_arabic | |
end | |
end | |
def to_arabic(string) |
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
Question 1: Make a method that takes a number. Console log numbers that is a multiple of 3, 5, and 7 with fizz, buzz, russ respectively | |
@array = [] | |
def fizz_buzz_russ(number) | |
@array = (1..number).to_a | |
@array.each do |i| | |
if (i % 105 == 0) | |
puts "fizzbuzzruss" | |
elsif (i % 21 == 0) | |
puts "fizzruss" | |
elsif (i % 15 == 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
Question 1 | |
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. | |
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 15? | |
Note: m evenly divides n means simply that n/m is an integer. | |
def gcd(a, b) | |
until b == 0 do | |
x = b |
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
// Player "keeps" dice by clicking on dice. Can make active again by clicking again. | |
var diceClick = function() { | |
$(".dice").on("click", function(event) { | |
var dice = $(this); | |
var value = parseInt(dice.children().attr('data-value')); | |
if (dice.css("opacity") == OPACFULL) { | |
dice.css("opacity", DICEOPACHALF); | |
dice.children().addClass("dice-kept"); | |
game.keepDice(value); | |
checkCombo(); |
NewerOlder