frequently seen algorithm in interview