Problem of finding maximum of each component solved in log time