Skip to content

Instantly share code, notes, and snippets.

View eduzol's full-sized avatar
🛸

Ed Z eduzol

🛸
View GitHub Profile
@eduzol
eduzol / LRUCache.java
Created February 27, 2017 09:45
LRUCache implemented in Java
package com.zola.algorithms;
import java.util.HashMap;
public class LRUCache{
public static void main(String... args){
LRUCache cache = new LRUCache( 2 /* capacity */ );
package com.zola.leetcode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Stack;
public class Solution20 {
public static void main(String[] args) {
// Class name must be "Main"
import java.util.Arrays;
class Main {
/**
Given an array and a value, remove all instances of that value in place and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
class Pramp {
public static void main(String[] args) {
String doc = "practice makes perfect. get perfect by practice. just practice!";
Pramp solution = new Pramp();
List<Ocurrence> ocurrences = solution.process(doc);
//testing
//unique , counts, sort descending order
@eduzol
eduzol / popcorn.js
Last active July 10, 2018 03:37 — forked from suyesh/popcorn.js
/* Popular Ice Cream Totals Quiz
*
* Using the data array and .reduce():
* - Return an object where each property is the name of an ice cream flavor
* and each value is an integer that's the total count of that flavor
* - Store the returned data in a new iceCreamTotals variable
*
* Notes:
* - Do not delete the data variable
* - Do not alter any of the data content
/* Create A Reducer
*
* You need to create a reducer called "appReducer" that accepts two arguments:
* - First, an array containing information about ice cream
* - Second, an object with a 'DELETE_FLAVOR' `type` key
* (i.e., the object contains information to delete the flavor from the state)
*
* The action your reducer will receive will look like this:
* { type: 'DELETE_FLAVOR', flavor: 'Vanilla' }
*
/* Write a Curried Function
*
* Create a function called "houseBuilder" that should:
* - Accept the number of stories (floors)
* - Return a function
*
* The returned function should:
* - Accept the color of the house
* - Return a string in the following format:
* "building a <numOfStories>-story, <color> house"
package com.experis.cisco.test.ExperisCisco;
public class ExperisTest
{
public static void main( String[] args )
{
String testStr = "race car";
ExperisTest test = new ExperisTest();
boolean isPalindrome = test.isPalindrome(testStr);
/* get total number of followers*/
SELECT PERSON_ID, COUNT(*) AS NUM_FOLLOWERS
FROM FOLLOWERS
GROUP BY PERSON_ID order by PERSON_ID asc;
/* test query above*/
select * from FOLLOWERS where PERSON_ID =1 ORDER BY FOLLOWER_PERSON_ID ASC;
@eduzol
eduzol / amoeba.js
Last active February 20, 2018 11:20
Javascript method populationGrowth(simulationLength) that determines how many amoebas will exist after simulationLength steps
let fibonacci = ( n , dict ) =>{
if ( dict[n] ){
return dict[n];
}
if ( n <= 1 ){
return 1;
}