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
/* | |
Design a cash register drawer function checkCashRegister() that accepts purchase price as the first argument (price), payment as the second argument (cash), and cash-in-drawer (cid) as the third argument. | |
cid is a 2D array listing available currency. | |
Return the string "Insufficient Funds" if cash-in-drawer is less than the change due. Return the string "Closed" if cash-in-drawer is equal to the change due. | |
Otherwise, return change in coin and bills, sorted in highest to lowest order. | |
*/ |
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
/* | |
Compare and update the inventory stored in a 2D array against a second 2D array of a fresh delivery. Update the current existing inventory item quantities (in arr1). If an item cannot be found, add the new item and quantity into the inventory array. The returned inventory array should be in alphabetical order by item. | |
*/ | |
function updateInventory(arr1, arr2) { | |
// All inventory must be accounted for or you're fired! | |
var inventory = arr1.concat(arr2).reduce(function(acc, next){ | |
if(acc[next[1]]){ | |
acc[next[1]] += next[0]; | |
}else{ |
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
/* | |
Return the number of total permutations of the provided string that don't have repeated consecutive letters. Assume that all characters in the provided string are each unique. | |
For example, aab should return 2 because it has 6 total permutations (aab, aab, aba, aba, baa, baa), but only 2 of them (aba and aba) don't have the same letter (in this case a) repeating. | |
*/ | |
function permAlone(str) { | |
var regex = /(.)\1+/g; | |
var arr = str.split(''), permutations = [], temp; |
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
var Person = function(firstAndLast) { | |
// Complete the method below and implement the others similarly | |
this.first = firstAndLast.split(' ')[0]; | |
this.last = firstAndLast.split(' ')[1]; | |
this.getFirstName = function(){ | |
return this.first; | |
}; | |
this.getLastName = function(){ |
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
function orbitalPeriod(arr) { | |
var GM = 398600.4418; | |
var earthRadius = 6367.4447; | |
arr.forEach(function(obj){ | |
var orbPeriod = Math.round(2*Math.PI*Math.sqrt(Math.pow(earthRadius + obj.avgAlt, 3)/GM)); | |
obj.orbitalPeriod = orbPeriod; | |
delete obj.avgAlt; | |
}); | |
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
/* | |
Given an array arr, find element pairs whose sum equal the second argument arg and return the sum of their indices. | |
If multiple pairs are possible that have the same numeric elements but different indices, return the smallest sum of indices. Once an element has been used, it cannot be reused to pair with another. | |
For example pairwise([7, 9, 11, 13, 15], 20) returns 6. The pairs that sum to 20 are [7, 13] and [9, 11]. We can then write out the array with their indices and values. | |
Index 0 1 2 3 4 | |
Value 7 9 11 13 15 | |
Below we'll take their corresponding indices and add them. |
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
android.useDeprecatedNdk=true | |
org.gradle.daemon=true | |
org.gradle.jvmargs=-Xmx1536M |
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
sudo service network-manager restart |
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
- npm i -S react-native@version | |
//such as, @0.43.3 | |
//and then | |
- react-native upgrade | |
//Alternate Solution | |
//install rninit | |
sudo npm install -g rninit | |
//then react-native project | |
rninit init [Project_Name] --source react-native@version |
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
apply plugin: "com.android.application" | |
import com.android.build.OutputFile | |
/** | |
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets | |
* and bundleReleaseJsAndAssets). | |
* These basically call `react-native bundle` with the correct arguments during the Android build | |
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the | |
* bundle directly from the development server. Below you can see all the possible configurations |
OlderNewer