Skip to content

Instantly share code, notes, and snippets.

View kaizokuace's full-sized avatar

Hasen Ahmad kaizokuace

View GitHub Profile
@kaizokuace
kaizokuace / LAMP_Assessment.md
Last active May 28, 2017 18:28
Appetize programmer test

LAMP Assessment

Write a PHP function that takes a sentence and returns the word with the most vowels.

Answer:

<?php
function mostVowels($sentence) {
    $sentence = preg_replace("/[^A-Za-z0-9 ]/", '', $sentence);
 $words = explode(' ', $sentence);
@kaizokuace
kaizokuace / findLargestRect.js
Created May 25, 2017 23:52
Find largest rectangle in metrix of 1 and 0
let matrix = [
[0,0,0,0,0,0,0,0,0,0],
[0,1,1,0,0,0,0,0,0,0],
[0,1,1,0,0,0,0,0,0,0],
[0,1,1,0,0,0,0,0,0,0],
[0,1,1,0,0,0,0,0,0,0],
[0,1,1,0,1,1,1,1,0,0],
[0,1,1,0,1,1,1,1,0,0],
[0,1,1,0,1,1,1,1,0,0],
[0,0,0,0,0,0,0,0,0,0],
class DictionaryLookupTools(object):
@staticmethod
''' Recursively finds a key in a dictionary '''
def find(key, dictionary):
return list(_find(key, dictionary))
@staticmethod
def _find(key, dictionary):
if isinstance(dictionary, list):
for d in dictionary:
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="bira"
# Example aliases
@kaizokuace
kaizokuace / fzbzOc.rb
Created November 17, 2012 05:32
FizzBuzz in Constant Time
raw_input = ["Buzz", "Fizz"]
input = raw_input[0, 7]
puts "For Input '#{raw_input.join(', ')}'"
matchMe = ["Fizz", "Buzz", "Fizz", "Fizz", "Buzz", "Fizz", "FizzBuzz","Fizz", "Buzz", "Fizz", "Fizz", "Buzz", "Fizz", "FizzBuzz"]
def real_index(index)
real_indices = [3,5,6,9,10,12,15,18,20,21,24,25,27,30]
multiplier = index/real_indices.size
real_indices[index%14] + multiplier*27 #total loop is 27
end
def sub_weight(start, length)