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
AI Photo Helper account delete guideline | |
Click menu icon > My Account > Delete Account | |
For questions contact: doncello@msn.com |
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 sumOddOrEven(num){ | |
return num.toString().split('').reduce((prev,cur)=> parseInt(prev, 10) + parseInt(cur, 10)) % 2 === 0 ? 'Even' : 'Odd' | |
} |
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
const fs = require("fs"); | |
const FILES = ["example", "example_big", "test"]; | |
const FILE_NAME = FILES[2]; | |
const source = require(`./${FILE_NAME}.in.json`); | |
let allResults = []; |
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
const MongoStore = require('connect-mongo'); | |
const express = require('express'); | |
const session = require('express-session'); | |
const { MongoMemoryServer } = require('mongodb-memory-server'); | |
const mongoose = require('mongoose'); | |
const request = require('supertest'); | |
const app = express(); | |
// This will create an new instance of "MongoMemoryServer" and automatically start it |
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
def merge_sort(array1, array2) | |
# write your code here | |
sortedArray = [] | |
while array1.length>0 && array2.length>0 | |
if (array1[0].split(' ')[0] > array2[0].split(' ')[0]) | |
sortedArray.push(array2[0]) | |
array2.shift() | |
else | |
sortedArray.push(array1[0]) | |
array1.shift() |
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
def merge_sort(array1, array2) | |
# write your code here | |
sortedArray = [] | |
while array1.length>0 && array2.length>0 | |
p array1, array2 | |
if (array1[0] > array2[0]) | |
sortedArray.push(array2[0]) | |
array2.shift() | |
else | |
sortedArray.push(array1[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
# Instead of copying the array into multiple sub-arrays, use indices to keep track of the different sub-arrays. | |
# You can pass the indices to a modified partition method. | |
# The partition method should partition the sub-array and then return the index location where the pivot gets placed, so you can then call partition on each side of the pivot. | |
# Since you cannot just create new sub-arrays for the elements, Partition will need to use another trick to keep track of which elements are greater and which are smaller than the pivot. | |
def partition(array, start_pointer, end_pointer) | |
# print [start_pointer, end_pointer], "\n" | |
# return array if array.length==1 | |
pivot_pointer = start_pointer |
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
# In Insertion sort, you simply went through each element in order and inserted it into a sorted sub-array. In this challenge, you cannot focus on one element at a time, but instead must deal with whole sub-arrays. Each time you call partition, you are sorting two parts of the array with respect to each other. Notice if you called partition on two elements, that sub-array would be fully sorted. | |
# Can you repeatedly call partition on each sub-array so that the entire array ends up sorted? | |
# In this challenge, print your array every time you finish your partitioning method, i.e. when you combine the partitioned array together. The first element in a sub-array should be used as a pivot. Partition the left side before partitioning the right side. Do not add the pivot to either side. Instead, put it in the middle when combining the two lists together. | |
def simple_quicksort(array) | |
# write your code here | |
# choose one > make two lists > loop the rest > if list bigger than 1 recurse > return all | |
pivot = array [ |
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
# In a Binary Search Tree (BST), | |
# an Inorder Successor of a node is defined as the node with the smallest key greater than the key of the input node. | |
# Given a node inputNode in a BST, | |
# you’re asked to write a function findInOrderSuccessor that returns the Inorder Successor of inputNode. | |
# If inputNode has no Inorder Successor, return null. | |
class Node | |
attr_reader :value | |
attr_accessor :left, :right |
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 five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers. | |
https://www.hackerrank.com/challenges/mini-max-sum/problem?isFullScreen=true | |
*/ | |
function miniMaxSum(arr) { | |
// Write your code here | |
let min=arr[0], max=arr[0]; | |
arr.forEach((num,i)=>{ | |
min = Math.min(arr[i],min) |