{{ message }}

Instantly share code, notes, and snippets.

# Cristian Cortez cortezcristian

Created Jul 10, 2020
Coding the Josephus Problem solution1.js
View solution1.js
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
 // My ugly first solution draft const solution = (n) => { // Ensure n is number if (typeof n !== 'number') return 0; // Ensure n is > 0 if (n < 1) return 0; // This array represents the circle const arr = []; // Fill the array with 1 ones to begin
Created Jul 10, 2020
Coding the Josephus Problem solution3.js
View solution3.js
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
 // Third solution binary based const solution3 = (n) => { // Convert to BIN const binaryStr = Number(n).toString(2); // Swapping digits const newBinaryStr = (binaryStr + binaryStr[0]).replace(/./, ''); // Convert back to DEC return parseInt(newBinaryStr, 2); };
Created Jul 10, 2020
Coding the Josephus Problem solution2.js
View solution2.js
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
 let nearestLowerPow2 = function (x) { if (x == 0) return 0; const arr = [1, 2, 4, 8, 16]; arr.forEach(function(n) { x |= (x >> n); }); return x - (x >> 1); }
Created Jul 10, 2020
Coding the Josephus Problem Nearest Lower Square
View Nearest_Lower_Square.csv
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
Number Nearest Lower Square 1 1 2 2 3 2 4 4 5 4
Last active Jul 10, 2020
Coding the Josephus Problem
View Nearest_Lower_Square.csv
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
Number Nearest Lower Square 1 1 2 2 3 2 4 4 5 4
Last active Aug 31, 2018
View har2superagent.md

Get the info

```const _ = require('lodash');
const fs = require('fs');
const agent = require('superagent');

const readJson = (path, cb) => {
fs.readFile(require.resolve(path), (err, data) => {
if (err)```
Created Jan 4, 2018

grep -lir "custome" app/migrations/201712* app/migrations/20171207120858.js app/migrations/20171222212151.js app/migrations/20171227151229.js

Last active Nov 23, 2017
Created Aug 18, 2016
A1 Candidate Viewer

# Issues, Bugs and Inconsistencies

1- Fix candidate case in labels, cases like "city" and "country" should be "City" and "Country"

2- Placeholders text. Fix inconsistencies like "Type candidate location" should be "Country" instead.

Last active Aug 12, 2016
Phoenix and Elixir
``````\$ brew install elixir