View vowelDoubler.js
const vowelDoubler = (arr) => {
let size = arr.length-1;
const vowels = {
'a': 'a',
'e': 'e',
'i': 'i',
'o': 'o',
'u': 'u',
};
arr.forEach((char) => { if(vowels[char]) { size +=1; } });
View gist:4a5a189ca1e413759b0418103b263617
> db.images.find({"location_id": 4000})
{ "_id" : ObjectId("5aea9fa7cc36a43685c9498c"), "src" : [ "https://s3-us-west-1.amazonaws.comhttps://gist.github.com/images-service-images/pic95.jpg", "https://s3-us-west-1.amazonaws.comhttps://gist.github.com/images-service-images/pic35.jpg", "https://s3-us-west-1.amazonaws.comhttps://gist.github.com/images-service-images/pic211.jpg" ], "location_id" : 4000, "caption" : "Aut ut ab dignissimos reprehenderit.", "__v" : 0 }
> db.images.find({"location_id": 4000}).explain("executionStats")
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "images.images",
"indexFilterSet" : false,
"parsedQuery" : {
"location_id" : {
View gist:8380b4145507c801cdd12838f78be993
var productExceptSelf = function(nums) {
var result = [];
result[0] = 1;
for(var i = 1; i < nums.length; i += 1) {
result[i] = nums[i-1] * result[i-1];
}
return result;
};
View kthSmallest
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @param {number} k
View gist:b7394ed771aec2c2bad2f5c6764149fb
import React from 'react';
import axios from 'axios';
import Brief from './components/Brief';
import Summary from './components/Summary';
import { Button } from 'react-bootstrap';
class ProductDetails extends React.Component {
constructor(props) {
super(props);
this.state = {
View cashAmount -class
class CashAmount {
constructor(cashMoney) {
this.cashMoney = parseFloat(cashMoney.toFixed(2));
}
totalInPennies() {
return (this.cashMoney * 100).toFixed(2);
}
addDoubleAmount(val) {
View Largest lvl of tree
const findLargestLevel = function(node) {
// We will be doing a BFS of a binary tree,
// Summing each level, and returning the largest level
let queue = [this];
let greatestLevelSum = 0;
let greatestLevel = 0;
let level = 0
while(queue.length > 0) {
// Sum up queue(which contains all current levels)