some code that i wrote after reading interviews questions, for fun