lee algorithm attempt