I hereby claim:
- I am acalpixca on github.
- I am acalpixca (https://keybase.io/acalpixca) on keybase.
- I have a public key ASBNc_mqgj32s5LAcnJfV_nIsw0XSgiaFAuzeePwdOg0kQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Para crear un repo en github y poblarlo con un proyecto ya existente (pero no en repo): | |
======================================================================================= | |
(versión larga: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/) | |
1. Crea el repo en Github y copia su url (sin README, licencia o gitignore). | |
2. Por linea de comandos accede a la carpeta/directorio donde esté el proyecto y... | |
3. Inicializa el repositorio | |
$ git init |
function minimumDiff(p) { | |
// old school solution | |
diff=0; | |
if (p.length>1) { | |
diff=Math.abs(p[1]-p[0]); | |
for (i=0;i<p.length;i++){ | |
for (j=i+1;j<p.length;j++){ | |
if (Math.abs(p[j]-p[i])<diff){ | |
diff=Math.abs(p[j]-p[i]); | |
} |
/* | |
Now, onto this week! | |
Given two strings, return if they have a common substring. | |
Bonus: Return the common substring(s). | |
Bonus x2: Do the original question plus the first bonus in less than O(n^2) time! | |
*/ |
/* Given two sets of rectangles (where each is represented by an array of four elements, where the first two elements are the coordinates of | |
the upper left corner, and the second pair is of the bottom right), determine the area of the space in which they overlap. | |
Example: | |
> overlapArea([0,0,4,4], [2,2,4,4]) | |
> 4 | |
*/ | |
function area(r){ | |
// base x altura |
//Given a queue, write a recursive function to reverse it. | |
function reverse(q) { | |
if (q.length === 1) { | |
return(q); | |
} | |
else { | |
var head=q.shift(); | |
return(reverse(q).concat([head])); |
/* | |
Implement the charAt() and contains() functions using the best runtime possible. | |
Example: | |
> charAt(5) | |
> a | |
> "fish".contains("i") | |
> true | |
*/ |
// Given n, write a function that returns the sum of 1*1! + 2*2! + ... + n*n! | |
function factorial(n) { | |
if (n===0) { | |
return(1); | |
} | |
else { | |
return(n * factorial(n-1)); | |
} | |
} |
/* | |
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. | |
Example: | |
waterTrap([2,0,2]) | |
> 2 | |
Structure is like this: | |
| | | |
|_| |
/* | |
Given an int array, remove all leading zeros from the array. | |
removeLeading({0, 0, 0, 1, 0, 2, 3}) | |
> 1 0 2 3 | |
*/ | |
function removeZeros(s) { | |
if (s.length<=0) { | |
return ([]); |